About behavior of DockSiteLayoutSerializer.CanKeepExistingDocumentWindowsOpen

Docking/MDI for WPF Forum

Posted 7 months ago by Yuki
Version: 23.1.3
Avatar

Hello,

I would like to ask you about DockSiteLayoutSerializer.CanKeepExistingDocumentWindowsOpen.

If layout data has closed document window and the window is opened in docksite, is it expected behavior that the window keep opening after executing layout desirialization?

  

Ex.)

1. Set DockSite.AreDocumentWindowsDestroyedOnClose to "False".

2. Open 3 document windows. (Document1, Document2, Document3)

3. Close Document3.

4. Save layout

5. Open Document3 again.

6. Load layout of step4.

--> (Expected behavior) Document3 is closed.

--> (Actual behavior) Document3 keep opening though the window is closed in layout data.

  

The following is description of DockSiteLayoutSerializer.CanKeepExistingDocumentWindowsOpen.

// Gets or sets whether existing open document windows are kept open during a layout
// serialization that affects the MDI area, even when they aren't listed in the
// loaded layout data.

  

I'm thinking it is expected behavior if DockSite.AreDocumentWindowsDestroyedOnClose is "True".

--> It is because Document3 is not listed in the layout data.

  

However, I expect that Document3 is closed in above case. 

--> It is Because Document3 is listed in the layout data.

[Modified 7 months ago]

Comments (4)

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

Hello,

Thank you for the sample project.  I think things are working as expected in the sample you submitted separately.

If I run the sample app with no changes and execute the "Load Default Layout" menu item while CanKeepExistingDocumentWindowsOpen = true in the LoadDefaultLayoutMenu_Click method, I see all three tabs remaining open.

Whereas if I run the sample app with no changes other than changing CanKeepExistingDocumentWindowsOpen and execute the "Load Default Layout" menu item while CanKeepExistingDocumentWindowsOpen = false in the LoadDefaultLayoutMenu_Click method, I do not see the third document tab remaining open.  The third document tab is marked closed in the default layout.

I did a similar test with dynamic saving and loading of layouts and saw the same proper result.

Are you seeing something different?  Make sure you are updating CanKeepExistingDocumentWindowsOpen everywhere in your sample code when testing values.


Actipro Software Support

Posted 7 months ago by Yuki
Avatar

Hello,

Thank you for your reply.

  

The following is description of DockSiteLayoutSerializer.CanKeepExistingDocumentWindowsOpen.

// Gets or sets whether existing open document windows are kept open during a layout
// serialization that affects the MDI area, even when they aren't listed in the
// loaded layout data.

I would like to ask you about CanKeepExistingDocumentWindowsOpen. (description which I added underline.)

Which is correct meaning of "they aren't listed in the loaded layout data"?

  1. Document window is contained in layout data, but it is not visible. (ex. "Document3" in <Layout data: No.1>)
  2. Document window is not contained in layout data. (ex. "Document3" in <Layout data: No.2>)
  3. Both of the above two.

From the description, I understood it as 2.

--> I expect that Document3 is closed when Documet3 is opening and <Layout data: No.1> is loaded.

Would you please check it?

<Layout data: No.1>

<DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SerializationFormat="All" Version="2">
	<AutoHideHost />
	<Content xsi:type="SplitContainer" Orientation="Horizontal" DockedSize="773.6,382.84000000000003">
		<UIElement xsi:type="Workspace">
			<Content xsi:type="TabbedMdiHost">
				<Content xsi:type="SplitContainer" Orientation="Horizontal" DockedSize="295,200">
					<UIElement xsi:type="TabbedMdiContainer" DockedSize="144.72854291417164,200" SelectedWindowUniqueId="769d7fb0-ca33-4d9c-819d-5622b21da692">
						<UIElement xsi:type="Track" ContainerDockedSize="144.72854291417164,200" CreationDateTime="2023-11-14T15:27:21.498258+09:00" UniqueId="c07abfe3-8ae4-4187-be38-9ea3b779770f" />
						<UIElement xsi:type="DocumentWindowRef" UniqueId="769d7fb0-ca33-4d9c-819d-5622b21da692" />
					</UIElement>
					<UIElement xsi:type="TabbedMdiContainer" DockedSize="144.27145708582836,200" SelectedWindowUniqueId="c07abfe3-8ae4-4187-be38-9ea3b779770f">
						<UIElement xsi:type="DocumentWindowRef" UniqueId="c07abfe3-8ae4-4187-be38-9ea3b779770f" />
					</UIElement>
					<UIElement xsi:type="TabbedMdiContainer" DockedSize="0,0">
						<UIElement xsi:type="Track" ContainerDockedSize="266,339.6" CreationDateTime="2023-11-14T15:27:29.5923888+09:00" UniqueId="9af505fc-889d-43d6-960f-d80fd22c12c5" />
					</UIElement>
				</Content>
			</Content>
		</UIElement>
		<UIElement xsi:type="ToolWindowContainer" SelectedWindowUniqueId="8a521468-2671-4e32-beff-cb607fe9ffd5">
			<UIElement xsi:type="ToolWindowRef" UniqueId="8a521468-2671-4e32-beff-cb607fe9ffd5" />
			<UIElement xsi:type="ToolWindowRef" UniqueId="b3840e65-a9f7-4ff6-8721-aeefc5b3ff3c" />
			<UIElement xsi:type="ToolWindowRef" UniqueId="ff40fc16-40dc-43b4-b936-c89c30059f75" />
		</UIElement>
	</Content>
	<DocumentWindows>
		<DocumentWindow UniqueId="769d7fb0-ca33-4d9c-819d-5622b21da692" SerializationId="Document1" ContainerDockedSize="144.72854291417164,200" IsOpen="true" LastActiveDateTime="2023-11-14T15:27:21.4716954+09:00" State="Document" />
		<DocumentWindow UniqueId="c07abfe3-8ae4-4187-be38-9ea3b779770f" SerializationId="Document2" ContainerDockedSize="144.27145708582836,200" IsOpen="true" LastActiveDateTime="2023-11-14T15:27:29.5894668+09:00" State="Document" />
		<DocumentWindow UniqueId="9af505fc-889d-43d6-960f-d80fd22c12c5" SerializationId="Document3" ContainerDockedSize="266,339.6" IsOpen="false" LastActiveDateTime="2023-11-14T15:27:27.0392222+09:00" State="Document" />
	</DocumentWindows>
	<ToolWindows>
		<ToolWindow UniqueId="8a521468-2671-4e32-beff-cb607fe9ffd5" SerializationId="Tool1" IsOpen="true" State="Docked" />
		<ToolWindow UniqueId="b3840e65-a9f7-4ff6-8721-aeefc5b3ff3c" SerializationId="Tool2" IsOpen="true" State="Docked" />
		<ToolWindow UniqueId="ff40fc16-40dc-43b4-b936-c89c30059f75" SerializationId="Tool3" IsOpen="true" State="Docked" />
	</ToolWindows>
</DockSiteLayout>

  

<Layout data: No.2>

<DockSiteLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" SerializationFormat="All" Version="2">
	<AutoHideHost />
	<Content xsi:type="SplitContainer" Orientation="Horizontal" DockedSize="773.6,382.84000000000003">
		<UIElement xsi:type="Workspace">
			<Content xsi:type="TabbedMdiHost">
				<Content xsi:type="SplitContainer" Orientation="Horizontal" DockedSize="406,200">
					<UIElement xsi:type="TabbedMdiContainer" SelectedWindowUniqueId="e0e32f0b-a163-4e4d-a62d-955bb9325e3a">
						<UIElement xsi:type="Track" CreationDateTime="2023-11-14T15:29:37.3254843+09:00" UniqueId="e4502c3c-a595-4e08-a807-4564258e8ed9" />
						<UIElement xsi:type="DocumentWindowRef" UniqueId="e0e32f0b-a163-4e4d-a62d-955bb9325e3a" />
					</UIElement>
					<UIElement xsi:type="TabbedMdiContainer" SelectedWindowUniqueId="e4502c3c-a595-4e08-a807-4564258e8ed9">
						<UIElement xsi:type="DocumentWindowRef" UniqueId="e4502c3c-a595-4e08-a807-4564258e8ed9" />
					</UIElement>
				</Content>
			</Content>
		</UIElement>
		<UIElement xsi:type="ToolWindowContainer" SelectedWindowUniqueId="19ea553b-241f-4e75-b4ae-02c6d38e10f2">
			<UIElement xsi:type="ToolWindowRef" UniqueId="19ea553b-241f-4e75-b4ae-02c6d38e10f2" />
			<UIElement xsi:type="ToolWindowRef" UniqueId="3a96e06e-d947-42b2-895b-6e7b953f4b5f" />
			<UIElement xsi:type="ToolWindowRef" UniqueId="d71c524f-022d-4e8b-95e3-53e0e548eedf" />
		</UIElement>
	</Content>
	<DocumentWindows>
		<DocumentWindow UniqueId="e0e32f0b-a163-4e4d-a62d-955bb9325e3a" SerializationId="Document1" IsOpen="true" LastActiveDateTime="2023-11-14T15:29:37.3023258+09:00" State="Document" />
		<DocumentWindow UniqueId="e4502c3c-a595-4e08-a807-4564258e8ed9" SerializationId="Document2" IsOpen="true" LastActiveDateTime="2023-11-14T15:29:37.3159042+09:00" State="Document" />
	</DocumentWindows>
	<ToolWindows>
		<ToolWindow UniqueId="19ea553b-241f-4e75-b4ae-02c6d38e10f2" SerializationId="Tool1" IsOpen="true" State="Docked" />
		<ToolWindow UniqueId="3a96e06e-d947-42b2-895b-6e7b953f4b5f" SerializationId="Tool2" IsOpen="true" State="Docked" />
		<ToolWindow UniqueId="d71c524f-022d-4e8b-95e3-53e0e548eedf" SerializationId="Tool3" IsOpen="true" State="Docked" />
	</ToolWindows>
</DockSiteLayout>
Answer - Posted 7 months ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

After some further discussion here, we do agree with you that if the deserialized layout data specifies information about a particular document window being closed, it should keep that document window closed after layout load, even if the document window was open prior to the layout load.

We are changing the logic for the next maintenance release to work in that manner.

The new description for the CanKeepExistingDocumentWindowsOpen property will be:

Gets or sets whether existing open document windows are kept open during a layout serialization that affects the MDI area, unless they are listed in the loaded layout data.


Actipro Software Support

Posted 7 months ago by Yuki
Avatar

Thanks a lot!!

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.