Specifically in MVVM Light toolkit? I've not dove into the Prism code yet to see what it does in regard to regions in a WPF UI. Seems like with the messaging and the ViewModelLocator in MVVM Light you could do a similar thing....Can you? Can anyone give some examples on how you could do this? Essentially I'd like to click on a button and load two different view models into the UI. Perhaps a better way to explain is Outlook-like Navigation Pane functionality.
相关问题
- VNC control for WPF application
- WPF Binding from System.Windows.SystemParameters.P
- JFX scale image up and down to parent
- XAML: Applying styles to nested controls
- How can I add a horizontal line (“goal line”) for
This can be done fairly easily in WPF, without any framework.
Just setup a DataTemplate in your Application (or at the Window/UserControl level) that maps the ViewModel to the View you wish to display for that ViewModel.
You can then just use a ContentPresenter, and bind it's contents to a single property (which can be of type
object
) within your ViewModel. When you want to set the "region" to a specific View, just set the property to the appropriate ViewModel, and WPF will automatically wire up everything for you.