c# - How do I register single event listener for all buttons -


how can listen button clicks in wpf app. maybe include of checkboxes or ideally not want have event handler.

i want collect initial statistics know how people use our application. want make sure not interfere other event handling functionality.

in application new windows being opened , closed own buttons can not statically.

alternatively there common way collect usage statistics wpf apps.

how can listen button clicks in wpf app?

you can hook events objects type using eventmanager:

eventmanager.registerclasshandler(typeof(button), button.clickevent, new routedeventhandler(button_click));  private void button_click(object sender, routedeventargs e) {  } 

in application new windows being opened , closed own buttons can not statically.

if create these windows in wpf, can hook window events such closed, sizechanged , got/lostfocus(). if these windows not wpf/winform based can use shellhook


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -