diff --git a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml index 961b43b7..baa1408f 100644 --- a/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml +++ b/samples/CS/XAMLBehaviorsSample/DataTriggerControl.xaml @@ -11,30 +11,23 @@ d:DesignWidth="800"> - - - - + + + + + + + - - - - - - - - - - - - - - - DataTriggerBehavior performs an action when the data the behaviors is bound to meets a specified condition. + + + + + DataTriggerBehavior performs an action when the data the behaviors is bound to meets a specified condition. In this example, when the bound data of the slider's value reaches above 50, the behavior triggers an action to change the color of the rectangle. - - - + + + <Rectangle x:Name="DataTriggerRectangle"> <Interactivity:Interaction.Behaviors> <Interactions:DataTriggerBehavior Binding="{Binding Value, ElementName=slider}" ComparisonCondition="GreaterThan" Value="50"> @@ -46,29 +39,96 @@ </Interactivity:Interaction.Behaviors> </Rectangle> - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + DataTriggerBehavior performs an action when the data the behaviors is bound to meets a specified condition. + In this example, when the bound enum changes its value, the behavior triggers an action to change the color of the rectangle based on which enum value it equals to. + + + + <Rectangle x:Name="DataTriggerEnumRectangle" Grid.Row="0" Fill="{StaticResource RoyalBlueBrush}" Stroke="{StaticResource HighlightBrush}" StrokeThickness="5"> + <Interactivity:Interaction.Behaviors> + <Interactions:DataTriggerBehavior Binding="{Binding State}" Value="StateOne"> + <Interactions:ChangePropertyAction PropertyName="Fill" Value="Red"/> + </Interactions:DataTriggerBehavior> + <Interactions:DataTriggerBehavior Binding="{Binding State}" Value="StateTwo"> + <Interactions:ChangePropertyAction PropertyName="Fill" Value="Green"/> + </Interactions:DataTriggerBehavior> + <Interactions:DataTriggerBehavior Binding="{Binding State}" Value="StateThree"> + <Interactions:ChangePropertyAction PropertyName="Fill" Value="Blue"/> + </Interactions:DataTriggerBehavior> + </Interactivity:Interaction.Behaviors> +</Rectangle> + + + + + + + + + + + + + + + + + + + + + + - + + + + + + +