我们可以使用< I:Interaction.Triggers>在WPF MVVM(而不是在Silverlight) [英] can we use <i:Interaction.Triggers> in WPF MVVM (not in Silverlight)

查看:5309
本文介绍了我们可以使用< I:Interaction.Triggers>在WPF MVVM(而不是在Silverlight)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用< Interaction.Triggers /> 在WPF MVVM,而不是在Silverlight

Can I use <Interaction.Triggers /> in WPF MVVM rather than in Silverlight.

我所遇到的所有的例子显示使用< Interaction.Triggers /> 在Silverlight

All the examples I have come across show the use of <Interaction.Triggers /> in Silverlight.

我怎么可以用它在WPF?我使用MVVM模式。

How can I use it in WPF? I am using MVVM model.

推荐答案

添加一个引用到组装System.Windows.Interactivity

Add a reference to the assembly System.Windows.Interactivity

然后在XAML中声明为

then declare it in XAML as

xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"

或使用它,如果你已经安装了混合SDK

or use it if you have Blend SDK installed

xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" 

和使用它在XAML为

<i:Interaction.Triggers>
    <i:EventTrigger>

    </i:EventTrigger>
</i:Interaction.Triggers>

这篇关于我们可以使用&lt; I:Interaction.Triggers&GT;在WPF MVVM(而不是在Silverlight)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆