wpf - Navigate from MainView to another View -
I am new to WPF and I use the I have a very simple question but I can not get my head around it. How do I show a new view from the menu item on the main scene? My code looks like this: MainView.xaml Main viewModel. Cs What do I write in GoToNewPage to display the new page .gaml? Usually your application is fully run in view modals, Used to interact with ViewModels in a friendly manner. In your case, ViewModel can have a property in This WPF Model-View-View Model Toolkit 0.1 I'm doing my hand at the WPF
& lt; Menu dockpanel.doc = "top" & gt; & Lt; MenuItem header = "_file" & gt; & Lt; MenuItem command = "{binding newpage}" header = "new page" inputstarter = "Ctrl-N" /> & Lt; / MenuItem & gt; & Lt; / Menu & gt;
Private Delayed Commands Newpage Commands; Public ICD Newspage {get {if (newPageCommand == blank) {newPageCommand = new representative command (GoToNewPage); } Back new page commm; }} Private Zero GoToNewPage () {??? }
Current page , which is bound to
ContentControl.Content in your view. To change pages,
GoToNewPage will set the command
current page property to
NewPageViewModel .
ContentControl believes that it is binding, and in the process of updating bindings, it will feel that
content has changed And he needs to use a new
DataTemplate to attract that content.
& amp; Content control content = "{current binding page}" & gt; & Lt; ContentControl.Resources & gt; & Lt; DataTimeplate DataType = "{x: Type Local: Homeview View Module}" & gt; & Lt; Local: Homeviews / & gt; & Lt; / DataTemplate & gt; & Lt; DataTemplate DataType = "{x: type local: NewPageViewModel}" & gt; & Lt; Local: Newpage view / & gt; & Lt; / DataTemplate & gt; & Lt; /ContentControl.Resources> & Lt; / ContentControl> I have a simple example of this if you are interested
Comments
Post a Comment