Я хочу щелкнуть меню «Сейчас играет», а затем вызвать UserControl в сетку MainWindow
MainWindow.xaml:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Menu Height="30" VerticalAlignment="Top">
<MenuItem Height="30" Header="Now Playing" x:Name="NowPlaying" Click="NowPlaying_Click" />
<MenuItem Height="30" Header="Music Library" Click="MenuItem_Click" />
<MenuItem Height="30" Header="Play Schedule" />
<MenuItem Height="30" Header="Control" />
<MenuItem Height="30" Header="Option" />
</Menu>
<Grid Margin="0,30,0,0" x:Name="MainBoard">
(UserControl"NowPlaying")
</Grid>
</Grid>
MainWindow.xaml.vb
Private Sub NowPlaying_Click(sender As Object, e As RoutedEventArgs) Handles NowPlaying.Click
Dim MainWindow = TryCast(System.Windows.Window.GetWindow(Me), MainWindow)
Dim MainWindowBoard = MainWindow.MainBoard
Dim NowPlayingBoard As UserControl = New NowPlaying
#???
End Sub
UserControl.xaml:
<Grid>
<Grid Width="800" Margin="0,0,0,100"/>
<Grid Margin="0,350,0,0" Background="#FFFFDADA">
<Slider Margin="10,10,10,0" VerticalAlignment="Top" Height="30"/>
</Grid>
</Grid>