Swatto

Swatto

  • NA
  • 23
  • 10.5k

Style not applying

Mar 24 2015 6:40 AM
Good Morning all,

For some reason this style is not working for my ContextMenu item, please could you tell me why?

Thanks for any help

    <Style x:Key="MyStyle" TargetType="MenuItem">
        <Style.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="TextBlock.TextDecorations" Value="Strikethrough"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <ContextMenu x:Key="SysTrayMenu">
        <MenuItem Header="Show Window" Command="{Binding ShowWindowCommand}" />
        <MenuItem Header="Hide Window" Command="{Binding HideWindowCommand}" Style="{StaticResource MyStyle}"/>
        <MenuItem Header="Exit" Command="{Binding ExitApplicationCommand}" />
    </ContextMenu>


Answers (8)