Serialized layout for floating windows

Docking/MDI for WPF Forum

Posted 8 months ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Version: 19.1.0684
Platform: .NET 4.7
Environment: Windows 7 (64-bit)
Avatar

Hi,

I have a tool window which is hidden by default, but should be floating when shown. It can be docked like any tool window, just the default mode should be floating. I assumed setting the property "IsFloating" would do the trick, but the value is always reverted when loading the serialized layout.

When the window is visible, the serialized layout is restored correctly (floating). But when I close the window, restart the application and show it again, it will be docked with the other windows (not floating).

I know I can achieve the behavior programmatically, but I was hoping to avoid that. Is there any other way?

[Modified 8 months ago]


Best regards, Tobias Lingemann.

Comments (3)

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

Hi Tobias,

Please see the "Docking/MDI / Docking Window Features / Lifecycle and Docking Management" topic in the documentation.  That has a "Default Locations" section in it that talks about a DefaultLocationRequested event that fires the first time a docking window opens.  You can set e.ShouldFloat = true in that.  That should trigger the docking window to float on first open.

After that, any layout serialization should be properly serializing the floating state if it's floating when the layout is saved.  We haven't had reports of that not working, so if you do see a problem, please let us know how to reproduce it in one of our samples.  Thanks!


Actipro Software Support

Posted 8 months ago by Tobias Lingemann - Software Devolpment Engineer, Vector Informatik GmbH
Avatar

Okay, thats what I mean with programmatically. Since the DefaultDockSide has no value for floating and WindowGroupName needs another docking window, I need to handle the events. There is no way to define it just in XAML or with the serialized default layout.

I was trying to avoid that since that would be the third location in my code that handles the default layout.


Best regards, Tobias Lingemann.

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

Hi Tobias,

The e.ShoudFloat property does get auto-initialized prior to the event being called with this logic:

e.ShouldFloat = (!hadTargetDockHost) && (window.IsFloating);

So if you new up a docking window in code and set IsFloating = true and then open it, it should float.  But if you defined the docking window in XAML, it will have already had a target DockHost assigned (the one in the DockSite that you indirectly put it in), so then e.ShouldFloat will be false by default before the event is called.


Actipro Software Support

The latest build of this product (v2019.1 build 0686) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.