欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

MouseDown not triggered?

系統 1883 0

In following case:

< Window x : Class ="WpfApplication59.MainWindow"

xmlns ="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

xmlns : x ="http://schemas.microsoft.com/winfx/2006/xaml"

Title ="MainWindow" Height ="350" Width ="525">

< Grid >

< Button HorizontalAlignment ="Center" VerticalAlignment ="Center" MouseDown ="Button_MouseDown"> test </ Button >

</ Grid >

</ Window >

?

public partial class MainWindow : Window

{

public MainWindow()

{

InitializeComponent();

this .AddHandler( Button .MouseDownEvent, new MouseButtonEventHandler (Test), true );

}

?

private void Button_MouseDown( object sender, MouseButtonEventArgs e)

{

Console .WriteLine( "mousedown from button." );

}

?

private void Test( object sender, MouseButtonEventArgs e)

{

Console .WriteLine( "mousedown from test." );

}

}

?

The Button_MouseDown cannot be triggered, because MouseDown is a "bubbling" event, it means that child control on which the event happens handles it first, and only if it
declines to handle it, the event is passed on to the parent of that
control (and so on, until it reaches top). If you want to capture the
event in a parent before the child sees it, you need to use a
"tunneling" event - in your case, it would be PreviewMouseDown.

?

As an alternative approach suggested is adding the line
AddHandler(FrameworkElement.MouseDownEvent, new
MouseButtonEventHandler(Test), true);
to your window's constructor after the call to InitializeComponent (and
remove "MouseDown="Button_MouseDown" from the XAML).

Below is the mainwindow:

MouseDown not triggered?

Click test button, see how the events were handled from snoop:

MouseDown not triggered?

First the preview… event is raised, then mousedown event raised, since the mousedown is already handled by button, so you cannot listen it outside.

?

?

MouseDown not triggered?


更多文章、技術交流、商務合作、聯系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號聯系: 360901061

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對您有幫助就好】

您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會非常 感謝您的哦!!!

發表我的評論
最新評論 總共0條評論
主站蜘蛛池模板: 一级片网 | 成人在线免费网站 | 夜精品A片观看无码一区二区 | 亚洲欧美日韩中文字幕久久 | 精品国产一区二区亚洲人成毛片 | 亚洲欧美日韩精品高清 | 欧美成人免费全网站大片 | 黄色免费av | 国产精品久久精品 | www.75zzz.com | 日韩不卡在线视频 | 欧美激情一区二区三区视频高清 | 玖玖精品视频在线观看 | 免费激情网站 | 亚洲欧美国产一区二区三区 | av在线在线 | 嗯啊你轻点好深啊hh在线播放 | 色婷婷香蕉 | 久久免费福利 | 91成人在线免费 | 欧美特黄a级高清免费看片 欧美精品一二区 | 天天爽夜夜爽夜夜爽 | 国产在亚洲线视频观看 | 中文字幕高清 | 久久国产欧美日韩精品 | 久久不色 | 九九51精品国产免费看 | 一级特黄特黄毛片欧美的 | 色噜噜噜噜噜在线观看网站 | 狠狠干天天干 | 96久久久久久 | 九色视频网 | 久久久久久久免费视频 | 欧美一区二区三区久久 | 一区二区三区国产好 | 2022国产成人福利精品视频 | 91专区在线观看 | 中文字幕第一页在线 | 国产精品一区视频 | 久久精品国内一区二区三区 | 日韩视频在线观看免费视频 |