Partager via


GoToStateAction Behavior (Compact 2013)

3/26/2014

You can use the GoToStateAction behavior to apply a trigger that activates a specified visual state.

In the following example, a Grid control uses the RaiseEventAction trigger to raise a navigation event in a XAML user interface. It uses GoToStateAction, defined by IXRGotoStateAction, to trigger a custom user action when the button is clicked.

<Grid x:Name="BT_NAVIGATION" Width="140" 
    MouseLeftButtonUp="BT_NAVIGATION_MouseLeftButtonUp" 
    HorizontalAlignment="Left" d:LayoutOverrides="Width">
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="MouseLeftButtonUp">
                <ui:RaiseEventAction 
                SourceName="Button" EventName="Navigation"/>
                    <ic:GoToStateAction 
                    StateName="NavigationButtonReleased"/>
            </i:EventTrigger>
            <i:EventTrigger EventName="MouseLeftButtonDown">
                <ic:GoToStateAction StateName="NavigationButtonPressed"/>
            </i:EventTrigger>
        </i:Interaction.Triggers>
</Grid>

See Also

Concepts

Expression Blend Behaviors in XAML for Windows Embedded
Behaviors, Actions, and Triggers