Detect Double Click of ToolWindow Title Bar when floating

Docking/MDI for WPF Forum

Posted 7 years ago by Matthew Bristow
Version: 17.1.0650
Avatar

Yet another "Double Click Title Bar Thread".

My requirement is to implement the ability to double click a ToolWindow to Maximise it, and then double click it again to dock it. 

I've implemented a beaviour in the style of ToolWindowContainer to be able to double click the title bar to make it floating, and then maximised. That works. The problem arises when I want to detect the double click of the title bar when it is floating.

Now from searching on the forum I found out that you tell Windows that it is a system title bar, and looking through snoop I can see no mouse interactions get through.

To get round this, in my behaviour I register to the WindowState changed event, so when I double click the title bar when floating, it changes the state from Maximise to Normal, which then I can say Dock but I get a "flash" of the Window going normal first, beofre it is docked which is not great on the eye.

Do you think this is the best apporach?

Comments (1)

Posted 7 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Matthew,

I'd probably suggest that you try to process the WM_NCLBUTTONDBLCLK windows message for the WPF Window that hosts the floating tool window.  You can override the DockSite.InitializeFloatingWindow method to see when a WPF Window is created to host a floating DockHost.  Then if that DockHost is one you want to give this functionality, you could hook the windows messages for it and process that one to hopefully block default functionality.

I think this page gives a way to hook the messages:

https://blogs.msdn.microsoft.com/nickkramer/2006/03/17/subclassing-windows-wndproc/


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.