【问题标题】:How to use Command for SelectionChanged of Pivot control如何使用命令进行枢轴控件的 SelectionChanged
【发布时间】:2013-09-22 12:52:16
【问题描述】:

我正在使用最新版本的 MVVMLight 开发 WP 应用程序。我知道如何使用 Command 而不是在按钮单击事件中编写代码。

<Button Content='Push me' Command='{Binding DisplayMessageCommand}' />

但是,我如何使用 Pivot control 的 SelectionChanged 命令? 我不想在 xaml 页面的 .cs 文件后面的代码中编写 SelectionChanged 事件中的代码。

【问题讨论】:

    标签: windows-phone-8 mvvm-light


    【解决方案1】:
    <i:Interaction.Triggers>
      <i:EventTrigger EventName="SelectionChanged">
        <i:InvokeCommandAction Command="{Binding SampleCommand}"/>
      </i:EventTrigger>
    </i:Interaction.Triggers>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-12
      • 1970-01-01
      • 2021-10-25
      • 2016-03-06
      • 2013-10-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多