动态绑定触摸事件
btnChangeErase.AddHandler(TouchDownEvent, new RoutedEventHandler(btnChangeErase_TouchDown), true);
btnChangeErase.AddHandler(TouchUpEvent, new RoutedEventHandler(btnChangeErase_TouchUp), true);
private void btnChangeErase_TouchDown(object sender, RoutedEventArgs e)
{
if (e is TouchEventArgs touch)
{
Trace.WriteLine("down");
btnChangeErase.CaptureTouch(touch.TouchDevice);
UpdateEraseDownTime();
}
}
popup无法打开解决方法
如果需要在触摸后打开popup,需要注意延时一段时间再打开,不然可能无法打开popup
[参考]
一点点从坑里爬出来:如何正确打开 WPF 里的 Popup?