tabbed mdi & removal of last documentwindow

Docking/MDI for WPF Forum

Posted 10 years ago by Willie
Version: 4.5.0486
Avatar
Hi,
I currently use the next code to find the active document in my tabbed mdi application.
When i close the last documentwindow, the mditabcontainer does not contain any childs and when i try to add a new documentwindow, the containers stays empty???
I saw about this in the past and that it should be fixed, but i still have this problem.

<docking:Workspace Margin="10,0,2,2" >
     <docking:TabbedMdiHost >
      <docking:TabbedMdiContainer Name="MDITabContainer"  >
    </docking:TabbedMdiContainer>
  </docking:TabbedMdiHost>
</docking:Workspace>

'retrieve the activce documentwindow
    Dim Dw As ActiproSoftware.Windows.Controls.Docking.DocumentWindow
    For i As Integer = 0 To MDITabContainer.Items.Count - 1
      Dw = MDITabContainer.Items(i)
      If Dw.IsSelected Then
        Return Dw
      End If
    Next


Comments (2)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
This is by design.

You should never hold references to any docking containers (TabbedMdiContainer, ToolWindowContainer, SplitContainer) because they all are transient and will be dynamically added and removed at run-time. Once you close the last document, the TabbedMdiContainer is removed and no longer used. When you add a new document, a new TabbedMdiContainer is created and used instead.

Use properties like DockSite.LastActiveDocument instead.


Actipro Software Support

Posted 10 years ago by Willie
Avatar
"DockSite.LastActiveDocument"

What you should do is using the mdicontainer host and check the hascontent.
If true, than the .content has a mdicontainer available which can be used.

[Modified at 04/14/2009 03:12 AM]
The latest build of this product (v2018.1 build 0675) 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.