We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add new tab at specific index poistion for WPF DockingManager?

Platform: WPF |
Control: DockingManager |
Published Date: January 29, 2016 |
Last Revised Date: August 3, 2021

You can add the document at specific index position for WPF DockingManager by setting DocumentTabOrderIndex.

XAML

 

//How to Add  new tab at specific index position for dockingmanager
<Window x:Class="DocumentTabOrder.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
                 Title="DocumentTabOrderIndex" Height="350" Width="525">  
      <Grid>
           <Grid.RowDefinitions>
                <RowDefinition Height="40" />
                <RowDefinition/>
           </Grid.RowDefinitions>
           <Button Content="add tab" Height="30" Width="200" VerticalAlignment="Center" HorizontalAlignment="Center" Click="AddItem"/>
           <syncfusion:DockingManager Grid.Row="1" x:Name="dockingManager" UseDocumentContainer="True">
               <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Tab1"  syncfusion:DockingManager.DocumentTabOrderIndex="1">
               </ContentControl>
               <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Tab2" syncfusion:DockingManager.DocumentTabOrderIndex="2">
               </ContentControl>
               <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Tab3" syncfusion:DockingManager.DocumentTabOrderIndex="3">
               </ContentControl>
               <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Tab4" syncfusion:DockingManager.DocumentTabOrderIndex="4">
               </ContentControl>
               <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Tab5" syncfusion:DockingManager.DocumentTabOrderIndex="5">
               </ContentControl>
           </syncfusion:DockingManager>
      </Grid>
</Window>

 C#

//How to Add  new tab at specific index position for dockingmanager
namespace DocumentTabOrder
{
  public partial class MainWindow : Window
  {
    public MainWindow()
    {
      InitializeComponent();
    }
    private void AddItem(object sender, RoutedEventArgs e)
    {
      Grid grid1 = new Grid();
      DockingManager.SetDocumentTabOrderIndex(grid1, dockingManager.Children.Count);
      DockingManager.SetHeader(grid1, "Tab " + (dockingManager.Children.Count + 1));
      DockingManager.SetState(grid1, DockState.Document);
      dockingManager.Children.Add(grid1);
    } 
  }
}

 

Adding new tab at specific position in WPF DockingManager

2X faster development

The ultimate WPF UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile