我有以下菜单,我不希望子菜单项超出应用程序窗口,我希望它们显示在按下的菜单项的右侧,而不是左侧。有什么建议吗?
<Menu DockPanel.Dock="Top" x:Name="MainMenu" Height="25">
<Menu.Background>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="#FF4C5568" Offset="1"/>
</LinearGradientBrush>
</Menu.Background>
<MenuItem Header="Medio" Foreground="White" HorizontalContentAlignment="Right" HorizontalAlignment="Right">
<MenuItem Header="Abrir archivo" VerticalAlignment="Top" HorizontalContentAlignment="Right" HorizontalAlignment="Left" x:Name="OpenVideoFile" Foreground="Black"/>
<MenuItem Header="Abrir disco" VerticalAlignment="Top" HorizontalContentAlignment="Right" HorizontalAlignment="Left" x:Name="OpenVideoDisc" Foreground="Black"/>
</MenuItem>
<MenuItem Header="Reproducci?n" SubmenuOpened="MenuItem_SubmenuOpened" IsEnabled="{Binding IsReady}" Foreground="White" HorizontalAlignment="Right">
<MenuItem Header="T?tulo" Foreground="Black" x:Name="TitleList" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding TitleList}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
<MenuItem Header="Cap?tulo" Foreground="Black" x:Name="ChapterList" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding ChapterList}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
<MenuItem Header="Subt?tulo" Foreground="Black" x:Name="SubtitleList" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding SubtitlesList}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
<MenuItem Header="Pista V?deo" Foreground="Black" x:Name="VideoTrack" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding VideoTracks}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
<MenuItem Header="Pista Audio" Foreground="Black" x:Name="AudioTrack" IsEnabled="{Binding IsDisc}" ItemsSource="{Binding AudioTracks}" ItemTemplate="{DynamicResource trackMenuItemTemplate}"/>
</MenuItem>
<MenuItem Style="{StaticResource MenuitemStyle}" Width="452" Height="27" >
<MenuItem.Header>
<Grid Visibility="Visible" MouseLeftButtonDown="WindowMouseLeftButtonDown" Background="Transparent"/>
</MenuItem.Header>
</MenuItem>
<MenuItem Width="50" Height="22" Style="{StaticResource MenuitemStyle}" RenderTransformOrigin="1.17,0.409">
<MenuItem.Header>
<Button Width="50" BorderThickness="0" x:Name="Close" HorizontalAlignment="Right" VerticalAlignment="Bottom" Style="{StaticResource CloseStyle}" Height="22" Click="Close_Click" Margin="0,0,-26,0"/>
</MenuItem.Header>
</MenuItem>
</Menu>
在这里你可以看到图片:
答案 0 :(得分:1)
我找出导致此问题的原因。由于Windows 8.1中的Microsoft新功能,它正在发生。控制面板中有一些设置 - &gt;平板电脑设置。取决于你是右手还是左手,你可以控制菜单的显示位置。