TabbedMdiContainer Issue

Docking/MDI for WPF Forum

Posted 11 years ago by Harry Nystrom
Version: 12.2.0571
Platform: .NET 4.0
Environment: Windows 7 (32-bit)
Avatar

I am working with a form that contains the following structure:

DockSite
     Workspace
          TabbedMdiHost
               TabbedMdiContainer
                    set of DocumentWindows

Some of the document windows are created in XAML.  Others are created or deleted programmatically.  I am having a problem with proper deletion.  When I perform the delete operation, all the affected document windows get properly removed from the DockSite DocumentWindows collection.  However, one of them does not get removed from the underlying TabbedMdiContainer DocumentWindow collection.  There are several unique characteristics concerning the window that does not get removed, but I have been unable to determine which might be affecting the operation.  This window has no title and no content (on purpose).  Also, at the time that it is removed, it has been tagged (not by me, but somehow behind the scenes) as the primary window.  What do I need to do to properly remove the window from the container as well as from the DockSite DocumentWindows collection?  (If I need to set another window as the primary one, how do I do this?).  Thanks.

Comments (3)

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

Hi Harry,

Its hard to say what's going on without a simple example we can debug.  But are you calling Destroy() on the document windows when you are done with them?  That will remove them from the DocumentWindows collection.  Also you may try calling Activate() on a remaining document window to change the primary window.


Actipro Software Support

Posted 11 years ago by Harry Nystrom
Avatar

I have discovered that if I both close the document window and then remove it from the docksite collection, it gets properly deleted from both the container and the docksite.  So, I have a solution, but I do not understand why I need to do both things.  Perhaps you could explain.  Thanks.

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

Hi Harry,

The closing action is what removes the window from the UI.  The removing from the DocumentWindows collection disassociates the document window from the DockSite.  When you call Destroy() on the document window, it should do both.  If you no longer want a document you should do the Destroy() call, although by default, documents that are closed will auto-destroy.  There's an option to prevent that though on the DockSite.


Actipro Software Support

The latest build of this product (v24.1.2) was released 0 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.