Skip to content

ChangePropertyAction

Jon W Chu edited this page Nov 19, 2015 · 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] (https://github.com/Microsoft/XamlBehaviors/wiki/API-Reference#xaml-behaviors-api-changes) for this Behavior. PropertyName takes in type PropertyPath instead of string.