Articles in this section
Category / Section

How to add newly created document at right side in WPF DockingManager?

1 min read

By default, document which added at runtime will be goes to left side of TabHeader. Document can be added at right side by AddTabDocumentAtLast property of DocumentContainer as true in WPF DockingManager. The same has been explained in the following code,

MainWindow.Xaml

<Grid x:Name="grid">
  <Grid.RowDefinitions>
    <RowDefinition Height="40"/>
    <RowDefinition/>
  </Grid.RowDefinitions>
  <Button Name="btn" Content="Add New Document" Click="btn_Click" Grid.Row="0">
  </Button>
  <syncfusion:DockingManager x:Name="DockingManager1" UseDocumentContainer="True" ContainerMode="TDI" Grid.Row="1">
    <ContentControl syncfusion:DockingManager.Header="Dock1" syncfusion:DockingManager.State="Document" />
  </syncfusion:DockingManager>
</Grid>

C#

public partial class MainWindow : Window
{
  public MainWindow()
  {
    InitializeComponent();
    (DockingManager1.DocContainer as DocumentContainer).AddTabDocumentAtLast = true;
  }
 
  private void btn_Click(object sender, RoutedEventArgs e)
  {
    ContentControl content = new ContentControl();
    DockingManager.SetHeader(content, "Dock" + (DockingManager1.Children.Count + 1).ToString());
    DockingManager.SetState(content, DockState.Document);          
    DockingManager1.Children.Add(content);           
  }
}

 

WPF DockingManager displays Add newly created document button

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