How to set the visibility of a document window

Docking/MDI for WPF Forum

Posted 12 years ago by Jamie Casterline
Version: 12.1.0562
Avatar

I cannot use the close and open method as the users have saved layout to an XML document and reopening the document window does not put the document window in the same place

I have tried 

<docking:DocumentWindow Title="Title" CanClose="False" x:Name="DocumentWindowName" Visibility="Collapsed">

This will hide the document window tab so that the document window cannot be activated again, but if the layout was saved with the collapsed window active then for some reason the document window is shown, but the tab is not

 So basically I need to be able to load a layout and then hide a document window if there is no data for it to display or show if there is data

 Below is the code I tried, Window1 is still displayed even though its tab is not

<docking:DockSite Grid.Row="1" CanDocumentWindowsRaft="True" x:Name="dockingSite">
<docking:SplitContainer>
<docking:Workspace>
<docking:TabbedMdiHost>
<docking:TabbedMdiContainer>
<docking:DocumentWindow Title="Title1" CanClose="False" x:Name="Name1" Visibility="Collapsed">
<ContentControl Regions:RegionManager.RegionName="Region1"/>
</docking:DocumentWindow>
<docking:DocumentWindow Title="Title2" CanClose="False" x:Name="Name2">
<ContentControl Regions:RegionManager.RegionName="Region2"/>
</docking:DocumentWindow>

<docking:DocumentWindow Title="Title3" CanClose="False" x:Name="Name3">

<ContentControl Regions:RegionManager.RegionName="Region3"/>
</docking:DocumentWindow>
</docking:TabbedMdiContainer>
</docking:TabbedMdiHost>
</docking:Workspace>
</docking:SplitContainer>
</docking:DockSite>

Comments (2)

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

Hi Jamie,

Sorry but you cannot use Visibility properties properly with our docking product.  They need to either be in the layout or not.

In the MDI area, windows that are activated will open into the currently active TabbedMdiContainer.  So if the active container changes while the docking window is closed, when it is reopened it will go into the new container.  That is standard behavior for MDI.

Maybe for your window you want to use a tool window instead and put it outside of the MDI area.  Then it will restore where it was.


Actipro Software Support

Answer - Posted 12 years ago by Jamie Casterline
Avatar

I figured out what the issue was with open and close

In order for this value to work on the DockSite AreDocumentWindowsDestroyedOnClose="False"

You need to load the layout first, then close the documentwindow you want to close.

My issue was that I could close the wndow, the layout would reopen it and then unexpected things happened.

So just in case anyone is wondering, if you useAreDocumentWindowsDestroyedOnClose="False" and load your layout then close the windows you don't want open after the layout loads

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