C#UIElement LostTouchCapture OnLostTouchCapture
我正在为MS Surface 2.0中的三星SUR40构建一个应用程序 我不能再让<代码>LostTouchCapture工作了 这是我的XAML代码:C#UIElement LostTouchCapture OnLostTouchCapture,c#,capture,pixelsense,uielement,C#,Capture,Pixelsense,Uielement,我正在为MS Surface 2.0中的三星SUR40构建一个应用程序 我不能再让LostTouchCapture工作了 这是我的XAML代码: <Rectangle x:Name="ActiveArea" Fill="Transparent" TouchDown="OnTouchDown" TouchMove="OnTouchMove" LostTouchCapture="OnLostTouchCapture" /> 触地和触地移动都有效
<Rectangle
x:Name="ActiveArea"
Fill="Transparent"
TouchDown="OnTouchDown"
TouchMove="OnTouchMove"
LostTouchCapture="OnLostTouchCapture"
/>
触地和触地移动都有效。但是我对LostTouchCapture
有一个问题。
该函数正在工作,但现在它坏了,我不知道为什么。我没有真的修复它,但我使用了
touchleef=“ontouchleef”
。无论如何,您使用了错误的事件,如果您想在触摸离开矩形时获得事件,touchleef
就是您要查找的事件,LostTouchCapture
事件是指您在UIElement
上使用TouchDevice
上的Capture
跟踪TouchDevice
(用于DragDrop
或操纵时发生的事件 您可以使用:
相反,它对我很有效。我认为这不是最好的解决方案,因为它一直在发射,但它似乎是迄今为止唯一有效的解决方案。我注意到,如果您删除触地
事件,就会触发触地
(您应该始终将IsManipulationEnable=true
添加到所需的UI元素中),但如果您同时将这两个元素都放入,则会停止触发触地
。也许这与处理着陆事件有关,但是我已经将其标记为错误,仍然没有运气。
private void OnLostTouchCapture(object sender, TouchEventArgs args)
{
Console.WriteLine("Hello World");
}