在主窗口中,我引用了两个用户控件:
<Window x:Class="MediaNet.View.MainWindow.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mainVM="clr-namespace:MediaNet.ViewModel.MainWindow"
xmlns:musicV="clr-namespace:MediaNet.View.MusicWindow"
xmlns:videoV="clr-namespace:MediaNet.View.VideoWindow"
Title="MainWindow" Height="350" Width="525">
<Window.DataContext>
<mainVM:MainWindowViewModel />
</Window.DataContext>
<Window.Resources>
<musicV:MusicWindow x:Key="musicView" />
<videoV:VideoWindow x:Key="videoView" />
</Window.Resources>
和内容控制:
<WrapPanel Width="362">
<ContentControl Content="" />
</WrapPanel>
我还有两个按钮来更改用户控件:
<Button Content="{Binding MenuNameMusic}" Command="{Binding Path=ShowMusicMenuCommand}">
<Button.RenderTransform>
<RotateTransform CenterY="0" CenterX="0" Angle="0" />
</Button.RenderTransform>
</Button>
<Button Content="{Binding MenuNameVideo}" Command="{Binding Path=ShowMusicMenuCommand}">
<Button.RenderTransform>
<RotateTransform CenterY="0" CenterX="0" Angle="0" />
</Button.RenderTransform>
</Button>
我应该如何在 MainWindow 的视图模型中更改 Content Control 的内容?