Языки программирования
- 1 ответ
- 0 вопросов
2
Вклад в тег
Window.Resources>
<DataTemplate x:Key="MainWindow" DataType="{x:Type viewModels:MergedModuleManagerViewModel}">
<ns:MainWindowView/>
</DataTemplate>
<DataTemplate x:Key="OpenProject" DataType="{x:Type viewModels:MergedModuleManagerViewModel}">
<ns:OpenProjectView/>
</DataTemplate>
</Window.Resources>
<Grid>
<ContentControl>
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="ContentTemplate" Value="{DynamicResource MainWindow}" />
<Style.Triggers>
<DataTrigger Binding="{Binding SwitchView}" Value="1">
<Setter Property="ContentTemplate" Value="{DynamicResource MainWindow}" />
</DataTrigger>
<DataTrigger Binding="{Binding SwitchView}" Value="2">
<Setter Property="ContentTemplate" Value="{DynamicResource OpenProject}" />
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid>