RestoreLayout doesn't delete existing Floating Windows

Mar 17, 2011 at 2:00 PM

Hello,

I found something, which I think is a bug or at least an unexpected behavior.

I have a saved layout without any floating windows. Then I programatically add floating windows to my current layout.
If I now restore layout to the saved state, the newly added floating windows are not destroyd.

Steps to reproduce this error with the latest AvalonDock Demo Application:
- Start program
- call Layout/Save To/Layout1
- call Dockable Contents/Create New Floating
- call Layout/Restore From/Layout1

What can I do to be sure that all floating windows that don't belong to the restored layout will be destroyed?

Mar 17, 2011 at 4:56 PM
Edited Mar 17, 2011 at 4:56 PM

Hello,

 

yes, we had the problem. Easy to solve:

//Close floating windows

FloatingWindow[] _floatingWindows = dockingManager.FloatingWindows;

for (int i = 0; i < _floatingWindows.Length; i++)

{

_floatingWindows[i].Owner = null;

_floatingWindows[i].Close();

}

 

I don't know why the developer of our team added _floatingWindows[i].Owner = null but he had probably good reasons ...

 



Hope this helps

Bernard from Sofa, an AvalonDock wrapper.