Articles in this section
Category / Section

How to add a new child with Document state at specific index position in DockingManager?

1 min read

In DockingManager, you can add a new child in Document state at the particular index using SetTDIIndex property.

XAML

<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <Button Name="AddTab" Content="Add Tab" Click="AddTab_Click"></Button>
        <syncfusion:DockingManager Name="Docking" Grid.Row="1" UseDocumentContainer="True">
            <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Dock1"></ContentControl>
            <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Dock2"></ContentControl>
            <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Dock3"></ContentControl>
            <ContentControl syncfusion:DockingManager.State="Document" syncfusion:DockingManager.Header="Dock4"></ContentControl>
        </syncfusion:DockingManager>
    </Grid>

C#

private void AddTab_Click(object sender, RoutedEventArgs e)
        {
            ContentControl Child = new ContentControl();
            DockingManager.SetState(Child,DockState.Document);
            DockingManager.SetHeader(Child,"Dock" + (Docking.Children.Count+1).ToString());            
            Docking.Children.Add(Child);
            TDILayoutPanel.SetTDIIndex(Child, 1);
        }

The following screenshot illustrates that a new Document Dock5 added at the index of 1 in DockingManager using SetTDIIndex,

Figure 1: New Document Dock5 added at the index of 1 in DockingManager

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied