8,735
社区成员
发帖
与我相关
我的任务
分享
<Window.Resources>
<Style TargetType="{x:Type Menu}">
<Setter Property="Background" Value="Black"/>
<Setter Property="FontFamily" Value="{DynamicResource {x:Static SystemFonts.MenuFontFamilyKey}}"/>
<Setter Property="FontSize" Value="{DynamicResource {x:Static SystemFonts.MenuFontSizeKey}}"/>
<Setter Property="FontStyle" Value="{DynamicResource {x:Static SystemFonts.MenuFontStyleKey}}"/>
<Setter Property="FontWeight" Value="{DynamicResource {x:Static SystemFonts.MenuFontWeightKey}}"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
</Style>
<Style TargetType="{x:Type MenuItem}">
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="White"/>
<Setter Property="Background" Value="Black"/>
</Style>
</Window.Resources>
<Grid>
<Menu Width="100" Height="20">
<!--设置快捷键_F-->
<MenuItem Header="_File">
<MenuItem Header="New"></MenuItem>
<MenuItem Header="Open"></MenuItem>
<Separator HorizontalAlignment="Stretch">
<Separator.Template>
<ControlTemplate>
<Border Background="red" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}"> <!-- 设置分隔符颜色-->
</Border>
</ControlTemplate>
</Separator.Template>
</Separator>
<MenuItem Header="Save"></MenuItem>
</MenuItem>
</Menu>
</Grid>