防止WPF中的冒泡事件 [英] Prevent Bubbling event in WPF

查看:1372
本文介绍了防止WPF中的冒泡事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



i有一个infragistics TabControl。其中有8个选项卡..
每个选项卡中的
我有一些文本框,组合框,按钮......等等。

i我正在调用Tabcontrol.Selectionchanged事件,但是它被激活了很多次。

如果我保留e.originalsource.name然后我也会得到组合框.. ..

i必须阻止这个组合框调用tabcontrol事件....

我该怎么做....





谢谢.....


i have a infragistics TabControl .There are 8 Tabs in that..
in each tab i have some design of textboxes,comboboxes, buttons ...etc..
i am calling Tabcontrol.Selectionchanged event but it is firing for so many times .
if i keep e.originalsource.name then i am getting comboboxes also....
i have to prevent this comboboxes from calling tabcontrol events ....
How should i do....


Thanks.....

推荐答案





只需抓住您想要处理的事件,并将事件标记为已处理。



例如:



Hi,

Just catch the event where you want to handle it, and mark the event a handled.

For example:

private void StackPanel_PreviewKeyDown(object sender, KeyEventArgs e)
{
    MessageBox.Show("StackPanel_PreviewKeyDown");
    e.Handled = true;
}





我在文章中找到了这个例子:



冒泡或隧道基本的WPF活动 [ ^ ]



最好的问候,



Shai



I've found this example at the article:

To bubble or tunnel basic WPF events[^]

Best Regards,

Shai


这篇关于防止WPF中的冒泡事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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