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.
You will need an object that contains both.
I would not use an anonymous type, just an example, since you want support for INotifyPropertyChanged. Basically you are looking for composition.