Hello,
I have lets say a WeeklyViewUserControl.xaml and a DailyViewUserControl.xaml.
Normally I used stuff like this to switch content:
<DataTemplate DataType="{x:Type ViewModel:LessonPlannerViewModel}">
<View:LessonPlannerDailyUC/>
</DataTemplate>
This worked so far. But now I have still the WeeklyViewUC which uses 90 % of the LessonPlannerViewModel code so I want to make this additionally:
<DataTemplate DataType="{x:Type ViewModel:LessonPlannerViewModel}">
<View:LessonPlannerWeeklyUC/>
</DataTemplate>
but this can not work, because from where does the ContentControl
know that VM (LessonPlannerViewModel) should display a DailyViewUC or a WeeklyViewUC ?
<ContentControl Content="{Binding VM}" />
This is my further scenario:
The DailyViewUC has a Button "Weekly View" which is executed via Command="{...}" to the Command in the LessonPlannerViewModel.
The WeeklyViewUC has a Button "Daily View"...
Depending on what button is pressed the datatemplate should somehow choose the appropriate UserControl to display!
How can I do that?