我的问题是我有一个窗口,其中包含一个Flyout,我的tabControl和TabItems,但是当我在Codebehind中添加一个tabItem时,Flyout在选中时新选项卡没有正确显示,它显示在选项卡内容下 我有以下xaml
<Controls:MetroWindow x:Class="Something.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
xmlns:views="clr-namespace:Something.Views"
xmlns:local="clr-namespace:SomethingUI"
mc:Ignorable="d"
Title="MainWindow" Height="600" Width="1000"
RightWindowCommandsOverlayBehavior="Never"
ResizeMode="CanResizeWithGrip"
GlowBrush="{DynamicResource AccentColorBrush}">
<Controls:MetroWindow.Flyouts>
<Controls:FlyoutsControl>
<Controls:Flyout IsPinned="False" Position="Right" Width="300" AreAnimationsEnabled="True" Header="Settings" IsOpen="{Binding IsSettingsFlyoutOpen,Mode=TwoWay}" >
<views:Settings x:Name="settingsViewModel"></views:Settings>
</Controls:Flyout>
</Controls:FlyoutsControl>
</Controls:MetroWindow.Flyouts>
<Controls:MetroWindow.RightWindowCommands>
<Controls:WindowCommands>
<Button Click="Button_Click"
Content="Settings"
ToolTip="Settings" />
</Controls:WindowCommands>
</Controls:MetroWindow.RightWindowCommands>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Controls:MetroTabControl Name="tabCtrl">
<Controls:MetroTabItem Header="Busqueda">
<views:Busqueda Margin="10"></views:Busqueda>
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="Playlists">
<views:Playlists Margin="10"></views:Playlists>
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="Downloads">
<views:Download Margin="10"></views:Download>
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="Biblioteca">
<views:Biblioteca Margin="10" x:Name="bibliotecaView"></views:Biblioteca>
</Controls:MetroTabItem>
<Controls:MetroTabItem Header="Reproductor" >
<views:Reproductor x:Name="reproductorView" Margin="0,10"></views:Reproductor>
</Controls:MetroTabItem>
</Controls:MetroTabControl>
<views:MiniRep Grid.Row="1" x:Name="miniRepView"></views:MiniRep>
</Grid>
当我在codebehind
中添加一个TabItem时var ctrl = new Streaming(videoItem.id.watch);
var tabCtrl = MainWindow.Instance.GetTab();
tabCtrl.Items.Add(new MetroTabItem { Header = "Streaming", CloseButtonEnabled = true, Content = ctrl });
弹出窗口位于标签下方 Image Flyout
如何在弹出窗口下方创建标签?