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我必須使用多個的菜單項