PointerPressed不工作的左键点击 [英] PointerPressed not working on left click
本文介绍了PointerPressed不工作的左键点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在创建WPF + C#为Windows 8地铁(微软UI)的应用程序,我遇到了一个按钮PointerPressed事件的困难。当我执行左键单击(鼠标)事件不会发生,但它在例右击鼠标或敲击发生。那么,什么是错的事件?
例如:
<按钮X:NAME =SomebuttonWIDTH =100HEIGHT =100
PointerPressed =Somebutton_PointerPressed/>
解决方案
解决的办法很简单:这些事件必须处理时不通过XAML但thorugh的AddHandler方法。
SomeButton.AddHandler(PointerPressedEvent,
新PointerEventHandler(SomeButton_PointerPressed),真);
Creating Metro (Microsoft UI) app for Windows 8 on WPF+C#, I met difficulty with PointerPressed event on a button. Event doesn't happen when i perform left-click (by mouse), but it happens in case with right-click or tap. So what's wrong with that event? for example
<Button x:Name="Somebutton" Width="100" Height="100"
PointerPressed="Somebutton_PointerPressed"/>
解决方案
The solution is pretty simple: these events have to be handled not through XAML but thorugh AddHandler method.
SomeButton.AddHandler(PointerPressedEvent,
new PointerEventHandler(SomeButton_PointerPressed), true);
这篇关于PointerPressed不工作的左键点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文