Getting shift/ctrl/alt states from a mouse event?

djcouchycouch picture djcouchycouch · Aug 14, 2009 · Viewed 9.7k times · Source

In my WPF App, how do I get the state of the shift, ctrl and alt keys in my mouse event handler? I seem to remember in MFC you could get that information from the mouse event.

Answer

Andy picture Andy · Aug 14, 2009

Assuming that you're still in the mouse event handler, you can check the value of Keyboard.Modifiers. I don't think that there is anyway to get modifier information from the event itself, so you have to interrogate the keyboard directly.