2014-08-28 62 views
1

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

+0

你能告诉我们你已经尝试什么,但没有工作?我们会帮助你更容易。 – Bun 2014-08-28 18:59:47

回答

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>