I'm in the process of learning WPF, so in my case I have an xbap application and the code below is the code behind MainView.xaml.cs. Also, it was initially of a Page Type and I just changed it to UserControl recently because I need to deploy this app using ClickOnce.
List of errors:
public partial class MainView : UserControl
{
public MainView()
{
InitializeComponent();
this.DataContext = MainViewModel.UniqueInstance;
MainViewModel.UniqueInstance.FrameNavigationService = _FrameViews.NavigationService;
_FrameViews.Unloaded +=new RoutedEventHandler(_FrameViews_Unloaded);
}
private void _FrameViews_Unloaded(object sender, RoutedEventArgs e)
{
_FrameViews.Content = null;
}
}
}
The InitializeComponent()
is only available in MainWindow not in MainView
you need to write like that:
public partial class MainWindow : Window
and the _FrameView
doesent exist you need to declare it