Skip to content

ChangePropertyAction

branh edited this page Dec 3, 2018 · 2 revisions

ChangePropertyAction represents an action that will change a specified property to a specified value when invoked.

Using this behavior causes the property with the given PropertyName on the TargetObject to take on the given Value.

If Increment is set to ture, the behavior will first attempt to increment by the given Value. If the property can not be incremented, it will be set to the value instead.

If a Duration is set, the transition from the old value to the new value will be animated.

SampleCode

XAML

<Button x:Name="Button">
  <Behaviors:Interaction.Triggers>
    <Behaviors:EventTrigger EventName="Click" SourceObject="{Binding ElementName=Button}">
      <Behaviors:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="LightYellow"/>
    </Behaviors:EventTrigger>
  </Behaviors:Interaction.Triggers>
</Button>