If you are looking for different UserControls based on the context of your data, just check out the next simple DataBinding and DataTemplate concept and extend it. Imagine you have a property called CurrentViewModel that binds to the contents of the ContentControl inside your window.
<Window ... <ContentControl Content="{Binding CurrentViewModel}" /> </Window>
Now imagine that you have ViewModel classes ClassA and ClassB, so set the instances in CurrentViewModel accordingly and define global DataTemplates (Views) for your classes
<DataTemplate DataType="{x:Type vm:ClassA}"> <local:UserControlForA../> </DataTemplate> <DataTemplate DataType="{x:Type vm:ClassB}"> <local:UserControlForB../> </DataTemplate>
Now, View is automatically controlled from the ViewModel logic, and WPF will take care of displaying the UserControl on the Datatemplate.
If you are not familiar with MVVM, better use this article. http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
source share