Detecting when a floating Window is docked

Docking/MDI for WPF Forum

Posted 8 years ago by Gareth Parris - Software Developer, McLaren
Version: 16.1.0633
Avatar

Hi, I can detect when a ToolWindow is floated by using this

protected override void OnFloatingWindowOpening(FloatingWindowOpeningEventArgs e)
{
base.OnFloatingWindowOpening(e);

if (e.DockHostChild.GetType() == typeof(ToolWindowContainer))

....

 

but how can I detect when a floating ToolWindow has been docked again in a similar fashion?

Comments (6)

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

Hi Gareth,

That event is really just for determining an initial size for a floated window.  I don't believe we raise an event when a tool window is later "Docked" again when it was already in a "Docked" state in a floating DockHost.  If there is a ToolWindow.State change, the DockSite.WindowStateChanged event fires.  But that doesn't happen when the tool window goes from Docked (in a floating dock host) to Docked (in the primary DockHost).

What do you need to know this particular scenario for?  That would help us understand the request better.


Actipro Software Support

Posted 8 years ago by Gareth Parris - Software Developer, McLaren
Avatar

Ok so I need to track and persist when tool windows have been floated so that when a floated tool window is closed and later re-opened again it needs to be in the floated state. Similarly if it is docked and then closed and re-opened, tool windows should be opened in a docked state.

[Modified 8 years ago]

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

Hi Gareth, 

Is the main problem that when you have a floating tool window that is closed and then you call ToolWindow.Open(), it's not showing as floating again?  I believe we have something related to that on our TODO list.  Having a docked tool window close and reopen via Open() should be working property already though, as should layout serialization/deserialization between application sessions.


Actipro Software Support

Posted 8 years ago by Gareth Parris - Software Developer, McLaren
Avatar

All I need to know is when a ToolWindow is in a docked state or an undocked state. I need to capture this at the time it happens so I can persist that value.

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

Hi Gareth,

After talking privately with you, it does seem like the main problem is not having previously floated docking windows reopen as floating.  That is something we have on our TODO list and will look into addressing.  Thanks!


Actipro Software Support

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

Hi Gareth,

For the upcoming 2017.2 version, we've implemented an e.ShouldFloat property for the DockSite.WindowDefaultLocationRequested event. Then the FloatingWindowOpening event can be used to customize its size.

We also have added a DockingWindow.IsFloating property that can be bound to for MVVM usage.

If you'd like to help beta test these features, please write us.


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.