有没有人用过Toolkit.GestureListener来触发EventToCommand?
发布于 2011-09-19 16:21:44
我不认为你可以使用EventToCommand行为来做到这一点,但是我已经创建了一个行为,它允许通过将GestureListener绑定到一个命令来轻松添加它们。
<Button Content="Start"
Behaviour:GestureListenerBehaviours.TapCommand="{Binding StartCommand}" />我只映射了敲击和双击,但如果需要的话,映射其余的应该很容易。请查看此链接以获取源代码
http://lazycowprojects.tumblr.com/post/10397441921/gesturelistenerbehaviourswp7
发布于 2011-06-16 15:04:27
这目前是不可能的。GestureListener.Tap不支持此功能。我在后面的代码中有一个事件处理程序,它使用datacontext调用viewmodel方法:
private void OnListItemTap(object sender, GestureEventArgs e)
{
var vm = DataContext as MyViewModel;
if (vm != null)
{
vm.TapOnItem.Execute(listbox.SelectedItem);
}
}https://stackoverflow.com/questions/3813608
复制相似问题