How to programmatically manage and identify specific Tab Groups in DockingManager?

Hello,

I am primarily using code-behind to manage the content within the DockingManager. I have encountered some challenges regarding Tab Group manipulation and would appreciate your guidance.

1. Targeting Specific Tab Groups for New Documents After calling CreateHorizontalTabGroup to split the DocumentContainer into top and bottom sections, I need to add new documents programmatically.

  • How can I specify which Tab Group (e.g., the top one or the bottom one) a new Document should be added to?

  • How can I control the specific insertion index of a new Document within that chosen Tab Group?

2. Clarification on TDILayoutPanel.SetTDIIndex I am aware of the TDILayoutPanel.SetTDIIndex API for setting a document's position. However, it doesn't seem to clarify how to target a specific Tab Group if multiple groups exist. Could you provide a code snippet or explanation on how to use this in a multi-group scenario?

3. Detecting Document Container Layout and Group Count For decision-making logic in my application, I need to programmatically "sense" the current state of the DocumentContainer:

  • How can I retrieve the total count of active Tab Groups?

  • How can I determine the hierarchical or positional relationship (e.g., which group is "above" or "to the left of" another) between these groups?

Are there specific methods or a way to traverse the internal layout tree (like TDISplitPanel or TDILayoutPanel) to get this information?

Thank you in advance for your help!



3 Replies

KA Karthick Arjunan Syncfusion Team February 23, 2026 12:09 PM UTC

Hi liwangqiang,

We have created a sample based on your requirement.

 

Query 1 – Adding a document to a specific tab group and setting its tab position:

When you split the document area using CreateHorizontalTabGroup or CreateVerticalTabGroup, Syncfusion generates separate tab groups internally using DocumentTabControl. You can identify these groups (for example, the upper vs. lower group) by checking their visual positions and then insert a new document into the desired group using DockingManager.AddElementToTabGroup(targetGroup, element). After adding the document, you can place it at a specific tab position by calling TDILayoutPanel.SetTDIIndex(element, index) (e.g., 0 for first tab or a high index for last). Kindly check the attached sample for reference.

 

Query 2 – How TDILayoutPanel.SetTDIIndex behaves with multiple groups:

SetTDIIndex only controls the order of a tab inside the tab group it is already in it cannot pick or switch the group itself. Therefore, when multiple tab groups exist, the correct workflow is, first add the document to the intended group using AddElementToTabGroup, and then call SetTDIIndex to position it within that group. Kindly check the attached sample for reference.

 

Query 3 – Detecting the number of tab groups and their layout positions:

To know how many tab groups currently exist, simply count the number of DocumentTabControl instances inside the DocumentContainer, each one represents a unique tab group. To determine which group is above/below or left/right, compare their on-screen coordinates. Kindly check the attached sample for reference.

 

The attached sample demonstrates how splitting creates new tab groups, how to identify each group, how to add documents into a selected group, how to reorder the tabs using SetTDIIndex, and how to detect the group count and layout orientation. It also includes clear helper methods that you can adapt directly in your project so you can easily control tab grouping behavior.

If we misunderstood your query, kindly provide a modified sample, screenshot, or a short demo video so we can assist you further.


Regards,
Karthick Arjunan


Attachment: WPFDockingManager_709b1eda.zip


LI liwangqiang March 2, 2026 04:00 AM UTC

Hi Karthick,

Thank you for the detailed explanation and the sample provided. It has been very helpful in understanding the relationship between DocumentTabControl and AddElementToTabGroup.

I have a follow-up question regarding the split behavior:

In my specific use case, I have fixed content that needs to reside in both the top and bottom sections of the DocumentContainer. When I use CreateHorizontalTabGroup, the new Tab Group is consistently created below the current one by default.

Is there a built-in way to specify the split direction so that the new Tab Group is created above the existing one? If there isn't a direct parameter for "Split Top," could you suggest a workaround—perhaps involving programmatically reordering the TDISplitPanel children or swapping the content between the groups after the split?

I would appreciate it if you could provide a code snippet or update the sample to demonstrate how to control this "Upper vs. Lower" creation logic.

Best regards,
Li wangqiang



KA Karthick Arjunan Syncfusion Team March 3, 2026 04:31 PM UTC

Hi Li wangqiang,


Sorry for any inconvenience caused,

At the moment, there isn’t a built‑in option to create a new horizontal tab group above the current group (i.e., a “Split Top” direction). We have analyzed your requirement for "Provide support for defining the insertion position of newly created tab groups". We have logged a feature request for the same. We will implement this feature in any of our releases; we will notify you once it gets published.


Feedback link: Provide support for defining the insertion position of newly created tab groups in WPF | Feedback Portal


At the planning stage for every release cycle, we review all open features and identify features for implementation based on specific parameters including product vision, technological feasibility, and customer interest. We will let you know when this feature is implemented. We appreciate your patience until then.

Thank you for requesting this feature and helping us define it. We are always trying to make our products better, and feature requests like yours are a key part of our product growth efforts.

If you have any more specifications/suggestions for the feature request, you can add them as a comment in the portal and cast your vote to make it count.


Regards,

Karthick Arjunan


Loader.
Up arrow icon