Loaded event of DocumentWindow fired when deserialize layout with ToolWindowOnly mode.

Docking/MDI for WPF Forum

Posted 7 months ago by Yuki
Version: 22.1.0
Avatar

Hello,

Regarding to title, is it expected behavior?

Is there any way to prevent it?

I checked with "Layout Serialization" sample.

Add Loaded event handler to "Saved Layout XML" window and execute save/load layout.

When the window is floating, Loaded event never fired.

Comments (2)

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

Thank you for reaching out. We looked deeper into the logic used for layout deserialization and unloading/loading of DocumentWindow instances cannot be completely avoided even when only deserializing ToolWindows.

Changes in ToolWindow layouts can affect the overall hierarchy and composition of the DockSite. In some scenarios, this change will result in a DocumentWindow being moved within the DockSite's composition and WPF will then raise the Unloaded/Loaded events.  Unfortunately, we cannot prevent this from happening.

A DockingWindow does expose several events you can use to accurately track when a window is opened/closed. You can find details about the various events at the following link:

https://www.actiprosoftware.com/docs/controls/wpf/docking/docking-window-features/docking-window-events

For instance, instead of using the DockingWindow.Loaded event, most DockingWindow code initialization should happen within the "DockSite.WindowsOpening" event.  That event fires right before the DockingWindow is opened into the UI.


Actipro Software Support

Posted 7 months ago by Yuki
Avatar

Thank you for replying.

I understand it. For now, I found other solution in our application.

The latest build of this product (v22.1.3) was released 23 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.