如何从$通过控制传递给它下面的一个p $ pvent点击给它、pvent

由网友(开着拖拉机向你求婚)分享简介:我在一组框中的文本框,都与双击事件。当我双击文本框中两个事件被触发。I have a textbox in a groupbox, both with double click events. When I double click in the textbox both events are triggered....

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

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:

previewMouseDoubleClick

在那里设置 e.Handled = TRUE

阅读全文

相关推荐

最新文章