In my MainWindow.xaml I have:
<Frame Grid.Row="1" Content="{Binding MainWindowModelData.ContentView}"/>
In my MainWindowModelData I have a property called ContentView:
private Page _ContentView;
public Page ContentView
{
get
{
if (_ContentView == null)
{
LicenceManagerModel pModel = new LicenceManagerModel();
LicenceManagerViewModel pViewModel = new LicenceManagerViewModel(pModel);
LicenceManagerView pView = new LicenceManagerView();
pView.DataContext = pViewModel;
_ContentView = pView;
}
return _ContentView;
//return _ContentView ?? (_ContentView = new Page());
}
set
{
Set(ref _ContentView, value);
}
}
The LicenceManagerView so far has the text under construction. Set(ref _ContentView, value); WILL RAISE THE PROPERTYCHANGE EVENT
When the program starts the ContentView is set and the 'under construction is shown' (It clearly has a reference to the LicenceManagerView.
In the MainWindowModel I have some code to change this ContentView property:
MenuModel pModel = new MenuModel();
MenuViewModel pViewModel = new MenuViewModel(pModel);
MenuView pView = new MenuView();
pView.DataContext = pViewModel;
ContentView = pView;
The ContentView property is raised and changed.
The problem: The ContentView is now pointing to a MenuView but the main window keeps displaying the 'Under Construction' from the LicenceManagerView.
What is going on?