Insert DocumentWindow in Sorted Order

Docking/MDI for WPF Forum

Posted 13 years ago by Billy Jacobs
Version: 11.1.0542
I am dynamically loading DocumentWindows to a dock site like so:
DocumentWindow documentWindow = new DocumentWindow(_dockSite, name, title, null, sourceObjectContainer.SourceObject);

Is there any way that I can insert the document window in a specific order. For example, lets say I have screen A-Z. If I open up Screen Z 1st and Screen A 2nd the tabs appear(from left to right) as tab Z then tab A. But, I want A to show to the left of Z. Is there a way to achieve this without removing all of the DocumentWindows from the DockSite and then re-adding them back?

The following also does not work:

DocumentWindow documentWindow = new DocumentWindow(null, name, title, null, sourceObjectContainer.SourceObject);

_dockSite.DocumentWindows.Insert(desiredIndex, documentWindow);


[Modified at 03/15/2011 01:46 PM]

Comments (1)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Billy,

The order in the DocumentWindows does not indicate the order of the tabs, as they can be opened in any custom layout.

You can reorder the items in the parent container after it has been opened though. Something like:
// Activate the document
DockingWindowContainer container = documentWindow.ParentContainer;
if (container != null) {
    container.Items.Insert(0, documentWindow);
We've added some helper methods (MoveToIndex, MoveToFirst, MoveToLast) on DockingWindow, which will make this a bit easier in the future.

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.