Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
110
MenuTool and ButtonTool IsPressed state
posted

When IsPressed, I want to change the Foreground to say Red.

I am able to get ButtonTool to work but I can't get MenuTool to work since there's no IsPressed DP.

I was able to get MenuTool response to IsOpen but that is only showing after IsMouseOver is false, some lower template is setting Foreground, I need to overrride that but I dont know where.

What is the best way for me to change text foreground to Red on MenuTool. Thanks. 

  • 54937
    Offline posted

    The MenuButtonArea is the element within the menu tool that renders the caption, image, etc. The template for this area has a trigger that when IsMouseOver is true, it changes the foreground; in theory this should also have a condition to not change it when its open. Since a template trigger will take precedence over a style setter, it is overriding your attempt to change the color. You will need to use a Style for the MenuButtonArea that has a trigger (since a local style trigger will take precedence over a template trigger).

    e.g.

    <Style TargetType="{x:Type igRibbon:MenuButtonArea}">

        <Style.Triggers>

            <DataTrigger Binding="{Binding Path=MenuTool.IsOpen, RelativeSource={RelativeSource Self}}" Value="True">

                <Setter Property="Foreground" Value="Green" />

            </DataTrigger>

        </Style.Triggers>

    </Style>