Articles in this section
Category / Section

How to dynamically add the document in UWP DockingManager?

1 min read

This article describes how to dynamically add the document in UWP DockingManager.

Use ButtonClick event to add the document dynamically in SfDockingManager. Set the State of adding element as document by using SetDockState property.

The following code example demonstrates the same.

XAML

<Button Content="Add New Document" Height="30" Margin="5" HorizontalAlignment="Center" Click="Button_Click"/>
<syncfusion:SfDockingManager x:Name="docking" Grid.Row="1">
   <ContentControl syncfusion:SfDockingManager.DockState="Document" syncfusion:SfDockingManager.Header="MainPage.xaml"/>
   <ContentControl syncfusion:SfDockingManager.DockState="Document" syncfusion:SfDockingManager.Header="App.xaml"/>
   <ContentControl syncfusion:SfDockingManager.DockState="Dock" syncfusion:SfDockingManager.Header="ToolBox" syncfusion:SfDockingManager.DesiredWidthInDockedMode="300"/>
   <ContentControl syncfusion:SfDockingManager.DockState="Dock" syncfusion:SfDockingManager.Header="Solution Explorer" syncfusion:SfDockingManager.SideInDockedMode="Right"  syncfusion:SfDockingManager.DesiredWidthInDockedMode="300"/>
   <ContentControl syncfusion:SfDockingManager.DockState="Dock" syncfusion:SfDockingManager.Header="Error List" syncfusion:SfDockingManager.SideInDockedMode="Bottom"/>
</syncfusion:SfDockingManager>

 

C#

public sealed partial class MainPage : Page
  {
    public MainPage()
      {
        this.InitializeComponent();
      }
    
    int i = 0;
    
    private void Button_Click(object sender, RoutedEventArgs e)
      {
        ContentControl element = new ContentControl();
 
        if (i == 0)
          SfDockingManager.SetHeader(element, "Document");
        else
        {
          SfDockingManager.SetHeader(element, "Document" + i);
        }
        SfDockingManager.SetDockState(element, DockState.Document);
        docking.Children.Add(element);
        i++;
      }
  }

 

The output for the above code is shown below:

 Conclusion

I hope you enjoyed learning about how to dynamically add the document in UWP DockingManager.

You can refer to our UWP DockingManager feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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