wpf menu style怎么修改
1个回答
展开全部
很简单啊,只要设置menu的style属性就行了,写了个demo给你,当然你也可以设置menuitem的style!~
<Menu Height="30" Width="100">
<Menu.Resources>
<LinearGradientBrush x:Key="bg" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF18A9EB" Offset="0.743" />
</LinearGradientBrush>
<Style TargetType="Menu">
<Setter Property="Background" Value="{StaticResource bg}"/>
</Style>
</Menu.Resources>
<MenuItem Header="Menu">
<MenuItem.Icon>
<Image Source="/工程名;component/图像1.png" />
</MenuItem.Icon>
<MenuItem Header="Menu1">
<MenuItem.Icon>
<Image Source="/工程名;component/图像2.png" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</Menu>
<Menu Height="30" Width="100">
<Menu.Resources>
<LinearGradientBrush x:Key="bg" EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="White" Offset="0" />
<GradientStop Color="#FF18A9EB" Offset="0.743" />
</LinearGradientBrush>
<Style TargetType="Menu">
<Setter Property="Background" Value="{StaticResource bg}"/>
</Style>
</Menu.Resources>
<MenuItem Header="Menu">
<MenuItem.Icon>
<Image Source="/工程名;component/图像1.png" />
</MenuItem.Icon>
<MenuItem Header="Menu1">
<MenuItem.Icon>
<Image Source="/工程名;component/图像2.png" />
</MenuItem.Icon>
</MenuItem>
</MenuItem>
</Menu>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询