Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can we use <i:Interaction.Triggers> in WPF MVVM (not in Silverlight) [closed]

Tags:

c#

mvvm

wpf

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.

like image 217
user2600034 Avatar asked Jul 19 '13 15:07

user2600034


People also ask

What is a command MVVM?

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.

How does WPF MVVM work?

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 WPF behavior?

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.


1 Answers

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> 
like image 158
Nitesh Avatar answered Sep 22 '22 11:09

Nitesh