Skip to content

ChangePropertyAction

Timo edited this page Jan 11, 2018 · 5 revisions

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

Using this behavior causes the PropertyName on the TargetObject to be changed to a specified Value

Sample Code

XAML

<Button x:Name="button1" Content="Yellow">
    <Interactivity:Interaction.Behaviors>
        <Interactions:EventTriggerBehavior EventName="Click" SourceObject="{Binding ElementName=button1}">
            <Interactions:ChangePropertyAction TargetObject="{Binding ElementName=DataTriggerRectangle}" PropertyName="Fill" Value="{StaticResource PaleYellowBrush}"/>
        </Interactions:EventTriggerBehavior>
        </Interactivity:Interaction.Behaviors>
</Button>

Note: There was a change in the API for this Behavior. PropertyName takes in type PropertyPath instead of string.