Articles in this section
Category / Section

How to get the notification on dock window resizing of WPF DockingManager?

1 min read

Window Resizing event of WPF DockingManager will be triggered when the size of the dock window is changed during resize operation. Sender of the Window Resizing event contains the information about the resized element and the event arguments contains the information about the current size of the Dock element. For instance, we have displayed the information about the resized element in the output window. The following code example demonstrate the same,

Mainwindow.xaml:

<syncfusion:DockingManager x:Name="docking" WindowResizing="Docking_WindowResizing">
  <ContentControl syncfusion:DockingManager.Header="Docking Left" syncfusion:DockingManager.SideInDockedMode= "Left" />
  <ContentControl syncfusion:DockingManager.Header="Docking Top"  syncfusion:DockingManager.SideInDockedMode= "Top"/>
  <ContentControl syncfusion:DockingManager.Header="Docking Right"  syncfusion:DockingManager.SideInDockedMode= "Right"/>
  <ContentControl syncfusion:DockingManager.Header="Docking Bottom"  syncfusion:DockingManager.SideInDockedMode="Bottom" />           
 </syncfusion:DockingManager>

Mainwindow.cs:

private void Docking_WindowResizing(object sender, WindowResizingEventArgs e)
{
  if (sender is DockedElementTabbedHost && (sender as DockedElementTabbedHost).HostedElement != null)
  {
    string header = DockingManager.GetHeader((sender as DockedElementTabbedHost).HostedElement).ToString();
    Console.WriteLine("Resized element header and size is" + header + "," + e.DesiredHeight + "," + e.DesiredWidth);
  }
}   

View sample in GitHub.

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