-
Notifications
You must be signed in to change notification settings - Fork 140
GoToStateAction
branh edited this page Dec 4, 2018
·
1 revision
GoToStateAction represents an action that will transition a FrameworkElement (i.e. Button) to a specified VisualState when triggered.
This behavior will change an element specified by TargetObject
or TargetName
to the visual state StateName
. Any transitions between the current and the new state will play unless UseTransitions
is set to false.
<Button x:Name="sampleStateButton">
<Button.Resources>
<Style TargetType="Button" >
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid x:Name="BaseGrid">
<VisualStateManager.VisualStateGroups>
<VisualStateGroup>
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BaseGrid" Storyboard.TargetProperty="Opacity" To="1.0" From="1.0"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimation Storyboard.TargetName="BaseGrid" Storyboard.TargetProperty="Opacity" To="0.25" From="1.0"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Button.Resources>
</Button>
<CheckBox x:Name="checkBox">
<Behaviors:Interaction.Triggers>
<Behaviors:DataTrigger Binding="{Binding IsChecked, ElementName=checkBox}" Value="False">
<Behaviors:GoToStateAction StateName="Normal" TargetObject="{Binding ElementName=sampleStateButton}"/>
</Behaviors:DataTrigger>
<Behaviors:DataTrigger Binding="{Binding IsChecked, ElementName=checkBox}" Value="True">
<Behaviors:GoToStateAction StateName="Disabled" TargetObject="{Binding ElementName=sampleStateButton}"/>
</Behaviors:DataTrigger>
</Behaviors:Interaction.Triggers>
</CheckBox>
- Introduction
- Contribution
- Behaviors Reference
- CallMethodAction
- ChangePropertyAction
- ConditionBehavior
- ControlStoryboardAction
- DataStateBehavior
- FluidMoveBehavior
- FluidMoveSetTagBehavior
- GoToStateAction
- InvokeCommandAction
- LaunchUriOrFileAction
- MouseDragElementBehavior
- PlaySoundAction
- RemoveElementAction
- SetDataStoreValueAction
- TranslateZoomRotateBehavior