Conditional execution of EventTriggers in Silverlight 3

Posted by Jason on Stack Overflow See other posts from Stack Overflow or by Jason
Published on 2010-04-21T13:58:38Z Indexed on 2010/04/21 15:13 UTC
Read the original article Hit count: 257

I'm currently working on the UI of a Silverlight application and need to be able to change the visual state of a control to one of two possible states based on it's current state when handling the same event trigger.

For example: I have a control that sits partially in a clipping path, when I click the visible part of the control I want to change the state to "visible" and if I click it again when it is in its "visible" state I want to change to the "hidden" state.

Example XAML:

            <i:Interaction.Triggers>
                <i:EventTrigger EventName="MouseLeftButtonUp">
                    <ic:GoToStateAction StateName="Visible"/>
                    <ic:GoToStateAction StateName="Hidden"/>
                </i:EventTrigger>
            </i:Interaction.Triggers>

Where "i" is "System.Windows.Interactivity;assembly=System.Windows.Interactivity" and "ic" is "Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions". I'm currently working in Expression Blend 3 and would prefer to have a XAML only solution but am not opposed to coding this if it is completely necessary. I have tried recording a change in the target state name in Blend but this did not work.

Any thoughts on this?

© Stack Overflow or respective owner

Related posts about xaml

Related posts about Silverlight