如何在UWP应用程序中使用EventToCommand(Catel)

时间:2016-04-05 16:23:52

标签: xaml mvvm catel eventtocommand

Windows Phone 8.1 Silverlight下面的代码就像魅力一样

<i:Interaction.Triggers>
<i:EventTrigger EventName="Loaded">
    <interactivity:EventToCommand Command="{Binding ApplyCommand}"
                       DisableAssociatedObjectOnCannotExecute="True"
                                  PassEventArgsToCommand="True" />
</i:EventTrigger>
</i:Interaction.Triggers>

在Universal Application(Windows 10)下是否存在任何工作方式?

1 个答案:

答案 0 :(得分:1)

在UWP(WinRT)中无法使用EventToCommand。您可以(或应该)使用它:

1.通过NuGet安装行为sdk

2.使用此代码

<Interactivity:Interaction.Behaviors>
  <Core:EventTriggerBehavior EventName="Loaded">
       <Core:InvokeCommandAction Command="{Binding ApplyCommand}" />
  </Core:EventTriggerBehavior>
</Interactivity:Interaction.Behaviors>