如何从$通过控制传递给它下面的一个p $ pvent点击 [英] How to prevent clicks from passing through a control to the one below it

查看:108
本文介绍了如何从$通过控制传递给它下面的一个p $ pvent点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一组框中的文本框,都与双击事件。当我双击文本框中两个事件被触发。

I have a textbox in a groupbox, both with double click events. When I double click in the textbox both events are triggered.

如何停止在文本框中点击穿过到组框?我试图把e.Handled = TRUE;在textbox_DoubleClick事件结束,但这没什么区别。

How do I stop clicks in the textbox from passing through to the groupbox? I've tried putting "e.Handled = true;" at the end of the textbox_DoubleClick event but this makes no difference.

推荐答案

由于WPF使用一个隧道/冒泡事件的传播模式,大多数事件开始从视觉树的底部向上冒泡。如果你想捉对方式的的,有 preVIEW 版本的事件,隧道向下的事件。例如:

Because WPF uses a "tunneling / bubbling" model of event propagation, most events begin bubbling UP from the bottom of the visual tree. If you want to catch an event on the way down, there are Preview versions of the events that tunnel downwards. For example:

<一个href="http://msdn.microsoft.com/en-us/library/system.windows.controls.control.$p$pviewmousedoubleclick.aspx"相对=nofollow> previewMouseDoubleClick

在那里设置 e.Handled = TRUE

这篇关于如何从$通过控制传递给它下面的一个p $ pvent点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆