We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Understanding DockingManagerDemo (SubscribeForEvents)

I have a button in one of the Grid areas in Window1.xaml of the DockingDemo2008 example.


I implemented DoSomething_MouseDown in Window1.xaml.cs
but the code is never being hit. It looks as if every event is intercepted by what is done by SubscribeForEvents().

Could someone explain this to me and how I can overcome this situation?

--
Christoph

2 Replies

MM Michael Matela June 11, 2010 01:24 PM UTC

MouseDown is a low-level event. It gets handled by the WPF button class and transformed into a Click event after some logic, such as only firing if both MouseDown and MouseUp are on the same element.

So you should either bind to the Click event or use the Command property. If you need to do something specific on MouseDown which cannot be handled by Click or Command (ex. change the styling), you could use PreviewMouseDown.


ES EXAPT Systemtechnik GmbH June 11, 2010 01:36 PM UTC

Ah, thanks Daniel , for explaining :) I just found out a minute ago, that PreviewMouse... Events do the right thing.

--
Christoph

Loader.
Live Chat Icon For mobile
Up arrow icon