0
不适用我已经创建的自定义控制,并在样式菜单项不工作我已经使用了支持算法FMP键应用该样式风格菜单项
通用XAML代码片断
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication3">
<Style x:Key="MenuItemStyle" TargetType="{x:Type MenuItem}">
<Setter Property="Height" Value="60"/>
<Setter Property="Background" Value="Red"/>
</Style>
<Style BasedOn="{StaticResource ResourceKey=MenuItemStyle}" TargetType="{x:Type MenuItem}"/>
<Style TargetType="{x:Type local:CustomControl1}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type local:CustomControl1}">
<Grid x:Name="MainGrid">
<Menu>
<MenuItem Header="File" />
</Menu>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
样式不申请菜单项,同时增加了风格类似下面代码工作,这个使用基于,因为在我的scnorio我必须使用多个的菜单项