【发布时间】:2012-01-05 05:27:49
【问题描述】:
我想在视图模型中处理我的视图 (PhoneApplicationPage) 的 Page_Loaded 事件。这曾经是通过以下方式完成的:
<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
<Command:EventToCommand Command="{Binding LoadedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
此方法使用 MVVM Light EventToCommand。
但他的方法不再有效并给出以下错误:
“EventToCommand”类型的值不能添加到集合中,或者 'TriggerActionCollection' 类型的字典。
在 WP7.1 中,将视图事件绑定到视图模型方法的正确 MVVM 方法是什么?
【问题讨论】:
标签: .net silverlight mvvm command windows-phone-7.1