views:

172

answers:

0

Hi there.

I'm having some trouble with making triggers do what I want them to...

I have a control that needs to have a contextual menu and a checkbox appear when you mouse over them.

Only thing is if the checkbox is checked it should remain visible.

Basically I have 4 storyboards - two to show/hide the checkbox, and two to show/hide the contextual menu.

The problem is the triggers aren't doing what I expected.

<MultiTrigger>
            <MultiTrigger.ExitActions>
                <BeginStoryboard x:Name="PageMouseOut_BeginStoryboard" Storyboard="{StaticResource PageMouseOut}"/>
            </MultiTrigger.ExitActions>
            <MultiTrigger.EnterActions>
                <BeginStoryboard Storyboard="{StaticResource PageOver}"/>
            </MultiTrigger.EnterActions>
            <MultiTrigger.Conditions>
                <Condition Property="IsChecked" SourceName="CheckSelected" Value="True"/>
                <Condition Property="IsMouseOver" Value="True"/>
            </MultiTrigger.Conditions>
        </MultiTrigger>

        <MultiTrigger>
            <MultiTrigger.ExitActions>
                <BeginStoryboard x:Name="PageMouseOut_BeginStoryboard2" Storyboard="{StaticResource OnUnchecked}"/>
                <BeginStoryboard x:Name="PageMouseOut_BeginStoryboard1" Storyboard="{StaticResource PageMouseOut}"/>

            </MultiTrigger.ExitActions>
            <MultiTrigger.EnterActions>
                <StopStoryboard BeginStoryboardName="PageMouseOut_BeginStoryboard" />
                <BeginStoryboard Storyboard="{StaticResource PageOver}"/>
                <BeginStoryboard x:Name="Checked_BeginStoryboard" Storyboard="{StaticResource Checked}"/>
            </MultiTrigger.EnterActions>
            <MultiTrigger.Conditions>
                <Condition Property="IsChecked" SourceName="CheckSelected" Value="False"/>
                <Condition Property="IsMouseOver" Value="True"/>
            </MultiTrigger.Conditions>
        </MultiTrigger>

What's happening (as far as I can tell) is that the enter action on one is over riding the exit action of the other. I have tried stopping the other storyboard but that will only work for one as it says that the other one is not applied to the object.

Is there a way of setting a storyboard to over ride all others?