【问题标题】:Binding Tapped event绑定 Taped 事件
【发布时间】:2014-08-28 18:56:28
【问题描述】:

我正在编写一个 Windows Phone 8.1 应用程序,我想获得绑定 Tapped 事件(例如,用于 Grid)功能。我阅读了许多文章和答案,但所有解决方案都不适用于我的情况。它是否存在触发器(System.Windows.Interactivity)或 WP 8.1 的命令的替代方案?

【问题讨论】:

  • 你能告诉我们你尝试过什么但没有成功吗?我们会更容易为您提供帮助。

标签: c# binding command windows-phone-8.1


【解决方案1】:

感谢您的关注,但我找到了解决方案。我可能太累了,忘记添加对 Behaviors SDK 的引用。现在效果很好。

<Page
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:core="using:Microsoft.Xaml.Interactions.Core" ...>

以及简单的命令用法:

<SomeControl ...>
<i:Interaction.Behaviors>
    <core:EventTriggerBehavior EventName="Tapped">
         <core:InvokeCommandAction Command="{Binding MyCommand}" />
    </core:EventTriggerBehavior>
</i:Interaction.Behaviors>
</SomeControl>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-22
    • 2017-07-05
    • 2011-07-13
    • 2016-07-29
    • 2011-01-01
    • 2011-12-14
    • 2010-11-29
    • 1970-01-01
    相关资源
    最近更新 更多