Articles in this section

How to find the child element of WPF DockingManager?

The child element of WPF DockingManager can be find by iterating the children collection of DockingManager. The following code example demonstrates the same.

MainWindow.Xaml

<syncfusion:DockingManager x:Name="SyncDockingManager" DockFill="True" UseDocumentContainer="True">
  <ContentControl Name="Content1" syncfusion:DockingManager.Header="Tab1" syncfusion:DockingManager.State="Document"/>
  <ContentControl Name="Content2" syncfusion:DockingManager.Header="Tab2" syncfusion:DockingManager.State="Document"/>
  <ContentControl Name="Content3" syncfusion:DockingManager.Header="Tab3" syncfusion:DockingManager.State="Document"/>
  <ContentControl Name="Content4" syncfusion:DockingManager.Header="Tab4" syncfusion:DockingManager.State="Document"/>
</syncfusion:DockingManager>        
<Button x:Name="button" Content="clickhere" Click="button_Click" VerticalAlignment="Bottom" HorizontalAlignment="Right"/>

C#

public partial class MainWindow : Window
{
  public MainWindow()
  {
    InitializeComponent();            
  }
 
  internal FrameworkElement FindChild(string nameForFind)
  {
    foreach (FrameworkElement element in SyncDockingManager.Children)
    {
      if (nameForFind == element.Name)
      {
        return element;
      }
    }
    return null;
  }
 
  private void button_Click(object sender, RoutedEventArgs e)
  {
    if (SyncDockingManager != null)
    {
      FrameworkElement Name = FindChild("Content2");
      if(Name == null)
      {
        MessageBox.Show("Child doesn't exsits in this name");
      }
               
      else
      {
        MessageBox.Show("Header of the element is " + DockingManager.GetHeader(Name));
      }
    }    
  }
}

 

WPF DockingManager displays child element

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