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.
Unfortunately, activation email could not send to your email. Please try again.

Understanding DockingManagerDemo (SubscribeForEvents)

Thread ID:

Created:

Updated:

Platform:

Replies:

94930 Jun 11,2010 06:36 AM Jun 11,2010 09:36 AM WPF 2
loading
Tags: Tools
EXAPT Systemtechnik GmbH
Asked On June 11, 2010 06:36 AM

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

Michael Matela
Replied On June 11, 2010 09:24 AM

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.

EXAPT Systemtechnik GmbH
Replied On June 11, 2010 09:36 AM

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

--
Christoph

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;