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!
精彩评论