wpf 触摸 触摸后无法打开pupup

动态绑定触摸事件


            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?

posted @ 2024-08-29 22:28  Hey,Coder!  阅读(3)  评论(0编辑  收藏  举报