<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!--菜单中的颜色画刷-->
<SolidColorBrush x:Key="MenuMouseOverBrush" Color="#cccccc"></SolidColorBrush>
<SolidColorBrush x:Key="MenuBackgroundBrush" Color="#e9e9e9"></SolidColorBrush>
<SolidColorBrush x:Key="MenuBorderBrush" Color="#bbbbbb"></SolidColorBrush>
<SolidColorBrush x:Key="MenuForegroundBrush" Color="#222222"></SolidColorBrush>
<!--菜单中小三角的颜色-->
<SolidColorBrush x:Key="ArrowBrush" Color="#222222"></SolidColorBrush>
<SolidColorBrush x:Key="ArrowOpenBrush" Color="#007acc"></SolidColorBrush>
<!--MenuStyle-->
<Style x:Key="MenuStyle" TargetType="Menu">
<Setter Property="Foreground" Value="{DynamicResource MenuForegroundBrush}"></Setter>
<Setter Property="Height" Value="25"></Setter>
<Setter Property="Background" Value="{DynamicResource MenuBackgroundBrush}"></Setter>
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="BorderBrush" Value="Transparent"></Setter>
<Setter Property="Margin" Value="5"></Setter>
<Setter Property="FontSize" Value="12"></Setter>
<Setter Property="OverridesDefaultStyle" Value="True"></Setter>
<Setter Property="SnapsToDevicePixels" Value="True"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Menu">
<Border BorderThickness="{TemplateBinding BorderThickness}"
BorderBrush="{TemplateBinding BorderBrush}"
Background="{TemplateBinding Background}"
Height="{TemplateBinding Height}">
<StackPanel ClipToBounds="True"
Orientation="Horizontal"
IsItemsHost="True" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--Separator-->
<Style TargetType="Separator" x:Key="SeparatorStyle">
<Setter Property="Margin" Value="0,2,0,2"></Setter>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Separator">
<StackPanel>
<Border BorderThickness="1" BorderBrush="#b8b8b8" Height="1"></Border>
<Border BorderThickness="1" BorderBrush="#ffffff" Height="1"></Border>
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--TopLevelHeader-->
<ControlTemplate x:Key="TopLevelHeader" TargetType="MenuItem">
<Border x:Name="Border">
<Grid>
<ContentPresenter ContentSource="Header" Margin="5"></Con
MenuStyle
最新推荐文章于 2023-01-31 17:11:18 发布
本文深入探讨了菜单样式的各种设计选项,包括下拉菜单、汉堡菜单、侧边栏菜单等,分析了它们在不同场景下的优缺点,并提供了实现这些菜单样式的最佳实践和技术要点。
摘要由CSDN通过智能技术生成