How to autohide the dockingchild in WPF DockingManager from codebehind?
To AutoHide the specific docking child of the WPF DockingManager in code behind, the ExecuteAutoHide() method is used.
For illustration, a button is created and the ExecuteAutoHide() method is invoked in the click event. On clicking the button, the ExecuteAutoHide() method is processed and the specified docking child is autohidden in the DockingManager.
The same is demonstrated in the following code example:
XAML
<Window x:Class="WpfApplication24.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> <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <Button Name="AutoHideTab" Grid.Row="0" Content="AutoHideTab" Click="AutoHideTab_Click"/> <syncfusion:DockingManager Name="Docking" Grid.Row="1"> <ContentControl Name="Dock1" syncfusion:DockingManager.Header="Dock1"/> <ContentControl Name="Dock2" syncfusion:DockingManager.Header="Dock2"/> <ContentControl Name="Dock3" syncfusion:DockingManager.Header="Dock3"/> </syncfusion:DockingManager> </Grid> </Window>
C#
namespace WpfApplication24 { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void AutoHideTab_Click(object sender, RoutedEventArgs e) { //This code is used to represent how to use ExecuteAutoHide method of DockingManager. Docking.ExecuteAutoHide(Dock1); } } }
The following output shows how the dock child is autohidden on clicking the AutoHideTab button.
Figure 1: Dock child autohidden
Conclusion
I hope you enjoyed learning about how to autohide dockingchild in WPF Docking Manager from codebind.
You can refer to our WPF DockingManager feature tour page to know about its other groundbreaking feature representations. You can also explore our WPF DockingManager documentation to understand how to create and manipulate data.
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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!