MultipleTriggers in same property but with different value?

77 Views Asked by At

Is it possible to have 2 Multitriggers applying on the same properties but with the condition having different values?

Basically I need to set the opacity to 0.5 if the IsChecked property is in true and the mouse it is not over it. But to 0.1 if the property IsChecked is in false and the mouse is not over the control. The Control that I am giving this behavior is a ToggleButton (We are trying to create a Pin button)


        <MultiTrigger>
            <MultiTrigger.Conditions>
                <Condition Property="IsChecked" Value="True"/>
                <Condition SourceName="OuterBorder" Property="IsMouseOver" Value="True"/>                    
            </MultiTrigger.Conditions>
            <MultiTrigger.EnterActions>
                <BeginStoryboard  Name="EnterStoryBoard2">
                    <Storyboard>
                        <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Opacity)" To="1"/>
                    </Storyboard>
                </BeginStoryboard>
            </MultiTrigger.EnterActions>
            <MultiTrigger.ExitActions>
                <BeginStoryboard Name="ExitStoryBoard2">
                    <Storyboard>
                        <DoubleAnimation Duration="0:0:0.3" Storyboard.TargetName="OuterBorder" Storyboard.TargetProperty="(Opacity)" To="0.5"/>
                    </Storyboard>
                </BeginStoryboard>
            </MultiTrigger.ExitActions>
        </MultiTrigger>

I was given the control with the first trigger, and I need to add the behavior for when it IsChecked is true. When I add the second trigger, the first one stops working. Is it possible to have 2 triggers like this?

Also I have no experience with this kind of effects in WPF, so I feel I am just doing it extra complicated, can I accomplish what I want in an easier way?

0

There are 0 best solutions below