Identifying which DocumentWindow just changed state to floating

Docking/MDI for WPF Forum

Posted 7 years ago by Nathan Hanson
Version: 16.1.0635

I've got a newbie question that I can't seem to find an answer for anywhere: When I handle DockSite.FloatingWindowOpening, I can't find anything that indicates to me which window is now in a floating state. The ActiveWindow and Primary Document are now both set to another DocumentWindow in the DockSite that got selected after I dragged the first window to a floating location. So how do I find out which window was dragged? There must be something simple I'm overlooking to get this info. Thanks in advance!

Comments (2)

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

Hi Nathan,

The e.DockHostChild of that event will pass the FrameworkElement being dragged.  Note that this could be a single docking window (if drag float previews are enabled), a ToolWindowContainer (one or more tool windows), or even a Workspace containing MDI (for a document).  You'd have to examine those and see which docking windows are part of them.

Actipro Software Support

Posted 7 years ago by Nathan Hanson

Thank you for the info! It helped me get the rest of the way to my answer. For others interested in the full solution to the riddle, here's how to dig down to a DocumentWindow when one is dragged to a floating position:

Your handler for the FloatingWindowOpening event will be passed a FloatingWindowOpeningEventArgs called e

e.HostChild will be a Workspace in the case of a DocumentWindow (As stated above)

If e.HostChild is a Workspace then Workspace.Content will be a TabbedMdiHost

And TabbedMdiHost.Child will be a TabbedMdiContainer

And TabbedMdiContainer has a property named SelectedWindow which will be the the DocumentWindow or DocumentWindow subclass that the user dragged to a floating state.

Hopefully, that'll help someone out there to solve the riddle faster than I did.

The latest build of this product (v24.1.2) 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.