Articles in this section
Category / Section

How to restore the closed window in WPF DockingManager?

2 mins read

You can restore the closed window at runtime by using ExecuteRestore() method in WPF DockingManager.

Syntax

//The method used to restore

ExecuteRestore(FrameworkElement child, DockState state);

Arguments:

Child - The element which need to be restore.

State - The state of the element which need to be restore.

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" Width="150" Height="23" Content="Restore the closed window" Click="Button1_Click" Grid.Row="0"/>
           <syncfusion:DockingManager x:Name="DockingManager" UseDocumentContainer="True" Grid.Row="1">
               <ContentControl syncfusion:DockingManager.Header="Child1"  x:Name="Content1"/>
               <ContentControl syncfusion:DockingManager.Header="Child2" x:Name="Content2"/>
               <ContentControl syncfusion:DockingManager.Header="Child3" x:Name="Content3"/>
           </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)
        {
            DockingManager.ExecuteRestore(Content3, DockState.Dock);
        }
      
    }
}

Here the below screenshot shows that Child3 is closed.

Closing child window in WPF DockingManager

Now on clicking the Restore the closed window button, the closed child3 is restored

Restoring child window in WPF DockingManager

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