开发者

How to make sender to be a Button and not the MainWindow in WPF CommandBinding?

The Button in WPF MainWindow has normal command attribute. When clicked the handler method receives sender. But the sender is always MainWidow. How to get sender to be a Button ? I need it to be a particular button, because I set this command to several buttons and want to use single handler for many开发者_运维百科 senders. Thank you


Check the OriginalSource on the event arguments, it should hold the sender who invoked the command!

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜