OnFloatingWindowOpened

Docking/MDI for WPF Forum

Posted 3 months ago by Kyle Kotwica
Version: 19.1.0686
Avatar

I want to know when all my documents are floating. I.e. no documents in the main docksite. In OnFloatingWindowOpening if I check the Documents IsFloating property it is false. What is the suggested way to determine this state?

Comments (5)

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kyle,

The DockingWindow.IsFloating property checks to see if the containing DockHost is floating (not the primary DockHost within the DockSite) and returns a boolean indicating that state.

If I add this code to our main Docking/MDI demo and then call it in response to a menu item, it seems to return true when all open documents are floating (or there are no open documents).

MessageBox.Show(dockSite.Documents.All(d => d.IsFloating).ToString());


Actipro Software Support

Posted 3 months ago by Kyle Kotwica
Avatar

Thanks for your reply. The use case I'm trying to deal with is when the primary dockhost has a document, and the user floats that document. I want to be able to determine if the primary dockhost has any remaining documents. I can use OnFloatingWindowOpening but at that point in time the IsFloating returns false. 

Answer - Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kyle,

Since it's still opening a DockHost into a floating window at that point, it probably hasn't registered the change yet.  Perhaps you could Dispatcher.BeginInvoke the call to your logic from that method using Loaded dispatcher priority?  That would likely give it enough time to finalize the layout change.


Actipro Software Support

Posted 3 months ago by Kyle Kotwica
Avatar

That worked, I don't suppose there is a way to tell when a floating window is moved back to the main document group?

Posted 3 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Kyle,

The DockSite.WindowsDockHostChanged event fires when the DockHost changes.  So that would fire when a document is floated or restored to the primary DockHost.


Actipro Software Support

The latest build of this product (v2020.1.1) was released 15 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.