免费视频淫片aa毛片_日韩高清在线亚洲专区vr_日韩大片免费观看视频播放_亚洲欧美国产精品完整版

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
wpf

What is the difference between sender and source in wpf event handling?

For example, say I had an ellipse in a canvas, and clicked on the ellipse: the ellipse would be both the sender and the source.

However if the ellipse doesn't handle the event but the main window does, the event will pass through the canvas... so the canvas would be the sender of the event to the main window but the source would be the ellipse.

Do I have that right?

asked Aug 29 '11 at 21:05
mihajlv
1,0251434

4 Answers

The difference between the two is not often seen, as usually the sender and Source are the same. Most code written like Windows Forms will basically ignore the difference and send them along as the same reference. However, given how WPF's event routing works they represent two different concepts.

sender is the object at which the event handler was attached. This is the owner that raised the handler to begin routing the event. From MSDN:

A difference between sender and Source is the result of the event being routed to different elements, during the traversal of the routed event through an element tree.

Source is the object where the event originates. In the case of tunneling and bubbling, the Source will be one of their child elements. You can use the OriginalSource property to peel back any event tree encapsulation.

answered Aug 29 '11 at 21:32
user7116
44.4k1190134
本站僅提供存儲服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊舉報
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
WPF Multi-Touch 開發(fā):基礎(chǔ)觸屏操作(Raw Touch)
WPF——Sender是什么
【W(wǎng)PF學習】第三十八章 行為
【W(wǎng)PF學習】第十八章 多點觸控輸入
WPF 動畫實戰(zhàn) 點擊時顯示圓圈淡出效果
【W(wǎng)PF學習】第五十六章 基于幀的動畫
更多類似文章 >>
生活服務(wù)
分享 收藏 導長圖 關(guān)注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服