WPF 窗口在关闭时将点击路由到后面的窗口!
private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
App.Current.MainWindow.Visibility = System.Windows.Visibility.Visible;
Close();
}
点击/点击事件也会发送到后面的任何窗口...
连这个bug都...
private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
App.Current.MainWindow.Visibility = System.Windows.Visibility.Visible;
System.Threading.Thread.Sleep(500);
Close();
}
private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
App.Current.MainWindow.Visibility = System.Windows.Visibility.Visible;
Close();
}
A click/click event is also send to any window behind...
Even this bugs...
private void Window_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
App.Current.MainWindow.Visibility = System.Windows.Visibility.Visible;
System.Threading.Thread.Sleep(500);
Close();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
MouseDoubleClick 是直接路由事件,因此即使设置
e.Handled = true
也不会影响树上的后续事件。处理双击的建议方法是处理MouseLeftButtonDown
,并检查ClickCount == 2
。然后,您可以设置e.Handled = true
,这应该可以防止事件冒泡。MouseDoubleClick is a direct routed event, and as such even setting
e.Handled = true
will not affect subsequent events up the tree. The suggested method for handling a double-click is to handleMouseLeftButtonDown
, and check forClickCount == 2
. You can then sete.Handled = true
, which should prevent the event from bubbling.