Category / Section
How to restore the elements from hidden to document state in WPF DockingManager?
1 min read
To restore the element from the hidden state to document state in WPF DockingManager, ExecuteDocument() method of DockingManager can be used. The same has been demonstrated in the following code snippet. For instance, we have changed the one hidden child to document using the button click event.
XAML:
<Window x:Class="DockingManager_KB.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 x:Name="Button1" Width="150" Height="23" Click="Button1_Click" Content="Change to Document" Grid.Row="0" /> <syncfusion:DockingManager x:Name="Docking" UseDocumentContainer="True" Grid.Row="1"> <ContentControl x:Name="Content1" syncfusion:DockingManager.Header="Child1" syncfusion:DockingManager.State="Hidden"/> <ContentControl x:Name="Content2" syncfusion:DockingManager.Header="Child2" syncfusion:DockingManager.State="Dock"/> <ContentControl x:Name="Content3" syncfusion:DockingManager.Header="Child3" syncfusion:DockingManager.State="Dock"/> <ContentControl x:Name="Content4" syncfusion:DockingManager.Header="Child4" syncfusion:DockingManager.State="Dock"/> </syncfusion:DockingManager> </Grid> </Window>
C#:
namespace DockingManager_ KB { /// <summary> /// Interaction logic for MainWindow.xaml /// </summary> public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); } private void Button1_Click(object sender, RoutedEventArgs e) { //This method used to change the child to Document child Docking.ExecuteDocument(Content1); } } }