Category / Section
How to autohide all the docking window at a stretch in WPF DockingManager?
1 min read
To autohide all the Docking Window present in the WPF DockingManager at a runtime, call the AutoHideAllDockWindow method of DockingManager. For instance, here we have called the AutoHideAllDockWindow method using button click event.
XAML
<Window x:Class="Application_New.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:syncfusion="http://schemas.syncfusion.com/wpf" Title="MainWindow" Height="350" Width="525"> <Grid x:Name="Grid1"> <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Button x:Name="Button1" Grid.Row="0" Width="150" Height="30" Content="AutoHideAllDockWindow" Click="Button1_Click"/> <syncfusion:DockingManager x:Name="DockingManager1" Grid.Row="1"> <ContentControl x:Name="Content1" syncfusion:DockingManager.Header="DockWindow1" syncfusion:DockingManager.State="Dock"/> <ContentControl x:Name="Content2" syncfusion:DockingManager.Header="DockWindow2" syncfusion:DockingManager.State="Dock"/> <ContentControl x:Name="Content3" syncfusion:DockingManager.Header="DockWindow3" syncfusion:DockingManager.State="Dock"/> <ContentControl x:Name="Content4" syncfusion:DockingManager.Header="DockWindow4" syncfusion:DockingManager.State="Dock"/> <ContentControl x:Name="Content5" syncfusion:DockingManager.Header="DockWindow5" syncfusion:DockingManager.State="Dock"/> </syncfusion:DockingManager> </Grid> </Window>
C#
using Syncfusion.Windows.Tools.Controls; namespace Application_New { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button1_Click(object sender, RoutedEventArgs e) { // calling the AutoHideAllDockWindow method of the DockingManager DockingManager1.AutoHideAllDockWindow(); } } }
The following screenshot shows the DockingManager contains five docking windows with a button on its top.
The following screenshot shows all the Docking windows get autohide on clicking the AutoHideAllDockWindow button.