【问题标题】:How to use EventToCommand (Catel) in UWP apps如何在 UWP 应用中使用 EventToCommand (Catel)
【发布时间】:2016-04-05 16:23:52
【问题描述】:

下面的代码在 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>

是否存在在通用应用程序(Windows 10)下工作的任何方式?

【问题讨论】:

  • 我建议你改一下标题,这其实和Catel没有关系,而是和UWP有关。一个建议是“如何在 UWP 应用程序中使用 EventToCommand”

标签: xaml mvvm catel eventtocommand


【解决方案1】:

EventToCommand 在 UWP (WinRT) 中不可用。您可以(或应该)改用它:

1.通过 NuGet 安装 Behaviors sdk

2.使用此代码

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-25
    • 2013-02-25
    • 1970-01-01
    • 1970-01-01
    • 2016-12-09
    • 1970-01-01
    相关资源
    最近更新 更多