8
Answers

Style not applying

Swatto

Swatto

9y
687
1
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)