Cannot restore hidden window

Docking/MDI for WPF Forum

Posted 11 years ago by Pasha
Version: 13.2.0590
Platform: .NET 4.5
Environment: Windows 8 (64-bit)

I try to load the saved layout


    public partial class MainWindow : Window
        private string m_layout = @"<DockSiteLayout xmlns:xsi="""" xmlns:xsd="""" SerializationFormat=""All"">
	<AutoHideHost />
	<Content xsi:type=""Workspace"" AutoHideSize=""274,232"" DockedSize=""274,232"" DocumentSize=""274,232"" FloatingSize=""274,232"" Size=""274,232"">
		<Content xsi:type=""TabbedMdiHost"">
			<Content xsi:type=""SplitContainer"" AutoHideSize=""274,232"" DockedSize=""274,232"" DocumentSize=""274,232"" FloatingSize=""274,232"" Size=""274,232"" Orientation=""Horizontal"">
				<UIElement xsi:type=""TabbedMdiContainer"" AutoHideSize=""134.5,232"" DockedSize=""134.5,232"" DocumentSize=""134.5,232"" FloatingSize=""134.5,232"" Size=""134.5,232"" SelectedWindowUniqueId=""45b992b9-0190-4585-b2dc-600c01ad2a70"">
					<UIElement xsi:type=""DocumentWindowRef"" UniqueId=""45b992b9-0190-4585-b2dc-600c01ad2a70"" />
		<DocumentWindow UniqueId=""45b992b9-0190-4585-b2dc-600c01ad2a70"" AutoHideSize=""134.5,232"" DockedSize=""134.5,232"" DocumentSize=""134.5,232"" FloatingSize=""134.5,232"" Size=""134.5,232"" IsOpen=""false"" LastState=""Document"" Name=""Editor"" StandardMdiBounds=""0,0,300,200"" State=""Document"" />

        public MainWindow()

        void Load()
            var serializer = new DockSiteLayoutSerializer
                SerializationBehavior = DockSiteSerializationBehavior.All,
                DocumentWindowDeserializationBehavior = DockingWindowDeserializationBehavior.AutoCreate,
            serializer.DockingWindowDeserializing += SerializerOnDockingWindowDeserializing;
                serializer.LoadFromString(m_layout, root);
            catch (Exception ex)


        private void SerializerOnDockingWindowDeserializing(object sender, DockingWindowDeserializingEventArgs e)
            e.Window.Header = "window1";


<Window x:Class="TestLoad.MainWindow"
        Title="MainWindow" Height="350" Width="525">
        <docking:DockSite x:Name="root">
            <docking:Workspace >

 I want to save the hidden status of restored window (IsOpen=false) but the serializer always oopens windows. How can I restore the saved IsOpen status?

Furthermore I want to use MVVM template in the application. Can I manage the IsOpen property from my viewmodel?

Now if I add

<Setter Property="IsOpen" Value="{Binding IsVisible, Mode=TwoWay}" />

 to the DocumentWindow style then the exception throws

"This operation is invalid since the DockingWindow has not yet been registered with a DockSite."

[Modified 11 years ago]

Comments (1)

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

Hi Pasha,

I looked at the code and it looks like you can't really change how things get deserialized.  You'd have to wait until after the layout has loaded, and then make adjustments as needed.  You could perhaps programmatically inject your IsOpen binding following layout load.

Actipro Software Support

The latest build of this product (v24.1.2) 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.