Can I use <Interaction.Triggers />
in WPF MVVM rather than in Silverlight.
All the examples I have come across show the use of <Interaction.Triggers />
in Silverlight.
How can I use it in WPF? I am using MVVM model.
What's a Command? Commands are an implementation of the ICommand interface that is part of the . NET Framework. This interface is used a lot in MVVM applications, but it is useful not only in XAML-based apps.
The single most important aspect of WPF that makes MVVM a great pattern to use is the data binding infrastructure. By binding properties of a view to a ViewModel, you get loose coupling between the two and entirely remove the need for writing code in a ViewModel that directly updates a view.
What is a behavior? A behavior encapsulate pieces of functionality into a reusable component, which we later on can attach to a element in a view. Emphasis is on reusable. One can do the same code in codebehind or perhaps directly in XAML so it is nothing magic about a behavior.
Add a reference to the assembly System.Windows.Interactivity
then declare it in XAML as
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
or use it if you have Blend SDK installed
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
and use it in XAML as
<i:Interaction.Triggers> <i:EventTrigger> </i:EventTrigger> </i:Interaction.Triggers>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With