Skip to content

WPF-942564: Add details about saving the layout and where to call the SaveDockState on DockingManager #1851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: hotfix/hotfix-v30.1.37
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion wpf/Docking/State-Persistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
layout: post
title: State Persistence in WPF Docking control | Syncfusion®
description: Learn here all about State Persistence support in Syncfusion® WPF Docking (DockingManager) control and more.
platform: WPF
platform: wpf
control: DockingManager
documentation: ug
---
Expand Down Expand Up @@ -124,6 +124,45 @@ Some of the formats are:
* XML file
* XmlWriter

### Where to call the Save and Load dock state:

To save the DockState of the DockingManager, call the [SaveDockState](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.DockingManager.html#Syncfusion_Windows_Tools_Controls_DockingManager_SaveDockState) method. You can call this method during any specific or desired scenario where preserving the layout is needed. For instance, before a window is closed or when switching between views.

{% tabs %}
{% highlight C# %}
// Saves the current dock state of the DockingManager when the window is closing event.
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
DockingManager1.SaveDockState();
}
{% endhighlight %}

{% highlight VB %}
' Saves the current dock state of the DockingManager when the window is closing event.
Private Sub Window_Closing(sender As Object, e As System.ComponentModel.CancelEventArgs)
DockingManager1.SaveDockState()
End Sub
{% endhighlight %}
{% endtabs %}

To load the previously saved DockState of the DockingManager when any specific desired scenario, call the [LoadDockState](https://help.syncfusion.com/cr/wpf/Syncfusion.Windows.Tools.Controls.DockingManager.html#Syncfusion_Windows_Tools_Controls_DockingManager_LoadDockState().html) method. This method can be called in any specific or desired scenario where you need to bring back a saved layout, such as during application initialization or after resetting the layout.

{% tabs %}
{% highlight C# %}
// Loads the previously saved dock state of the DockingManager on button click event.
private void LoadButton_Click(object sender, RoutedEventArgs e)
{
DockingManager1.LoadDockState();
}
{% endhighlight %}

{% highlight VB %}
' Loads the previously saved dock state of the DockingManager on button click event.
Private Sub LoadButton_Click(sender As Object, e As RoutedEventArgs)
DockingManager1.LoadDockState()
End Sub
{% endhighlight %}
{% endtabs %}

### Load and save the DockState using Isolated Storage:

Expand Down