Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5990577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:15:50+00:00 2026-05-22T23:15:50+00:00

I am making a Winodws Phone 7 program, I’ve got another question. So, my

  • 0

I am making a Winodws Phone 7 program, I’ve got another question. So, my question concerns, how would I bring in two classes using one datacontext? My code currently looks like:

    public MainPage()
    {
        InitializeComponent();

        DataContext = App.ViewModel;
    }

Now, what I want to do is add another Model:

    public MainPage()
    {
        InitializeComponent();

        DataContext = App.ViewModel, App.ViewModel2;
    }

But that doesn’t seem to work.

How would I make it to where I can have two objects in one form?

This is a silverlight / Windows Phone 7 application.

I need to have 2 modules loaded as one is for Accounts and the other is for Buddies, and I don’t want 10 different pages as it’d look nicer with just one page for all the normal things.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T23:15:51+00:00Added an answer on May 22, 2026 at 11:15 pm

    You will need an object that contains both.

    DataContext = new { VM1 = App.ViewModel, VM2 = App.ViewModel2 }
    

    I would not use an anonymous type, just an example, since you want support for INotifyPropertyChanged. Basically you are looking for composition.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a Button in Windows phone 7 without making use
I'm porting a 2D action game from Windows Phone 7 (developed in XNA 4.0)
I'm having trouble figuring out how to make a GET request using RestSharp on
I'm using robotium for testing and I'm running into a bunch of timing issues
I have an xml file which I am reading into an IEnumerable using linq,
The RAS API for Windows CE is making me cry and, as a C#
I am making a windows upper filter driver for serial and parallel ports. I
I want to reload the combo box so that it would display the values
I am attempting to create an application that will call a remote modem and
I want to save the state of application on deactivation because some how my

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.