按钮内的按钮 [英] Button inside a Button

查看:118
本文介绍了按钮内的按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在寻找一种在按钮内部设置按钮的方法,而不会触发所有这些路由事件。到目前为止,我不希望外部按钮在鼠标结束,按下等内部按钮时做出反应。

我很确定这很简单我只是不记得这个技巧。 br>

干杯,
Eric。


I'm looking for a way to have a button inside a button wihout all those routed event to be trigger. So far I do not want the external button to react when the mouse is over, pressed and so on on the inner button.

I'm pretty sure  this is pretty simple I just do not remember the trick.


Cheers,
Eric.

推荐答案

在内部按钮事件处理程序中,您必须提供e。 Handled = true

它是关于事件冒泡和隧道的....

请看下面的例子


In the inner button event handlers you have to give e.Handled=true

it is all about event bubbleing and tunneling....

please see the below example




< col style ="padding-left:10px; font-size:11px; border-bottom:#f7f7f7 1px solid; font-family:Courier New; white-space:nowrap">







< tr>
< 按钮 Horizo​​ntalAlignment = " Right" 保证金 = " 0,177,43,218 " 宽度 = " 175" 点击 = " Button_Click_1" >
< 按钮 宽度 = " 54" 高度 = " 27" 内容 = "按钮" ; 点击 = " Button_Click_2" />
< / Butt on >
   <Button HorizontalAlignment="Right" Margin="0,177,43,218" Width="175" Click="Button_Click_1">  
    <Button Width="54" Height="27" Content="Button" Click="Button_Click_2" /> 
   </Button> 
 


这篇关于按钮内的按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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