What are interaction triggers?

I am reading a Shawn Wildermuth article on Silverlight application architecture using MVVM light: - http://wildermuth.com/2010/01/02/Architecting_SL4_Apps_with_RIA_Services_MEF_and_MVVM_-_Part_4_%28of_3%29

I'm just wondering what is the difference between: -

<Button
Content="Previous Page" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction CommandName="PreviousPage"/>
<ei:CallMethodAction TargetObject="{Binding ElementName=grid}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button> 

AND

<Button Command="{Binding PreviousPage}"
Grid.Row="0"
Content="Previous Page" />

When do you specifically use triggers?

Thanks in advance:)

+3
source share
1 answer

The main reason for using a trigger to bind a command is if you want the trigger to fire an event other than Click. If you need a command for firing at the mouse, and not at the click of a button, you will need to use a trigger with a setting EventNameto handle the mouse.

, , . , . .

+5

Source: https://habr.com/ru/post/1761348/


All Articles