We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ResetState or DeleteDockState

Thread ID:

Created:

Updated:

Platform:

Replies:

148600 Oct 26,2019 06:48 PM UTC Nov 4,2019 05:35 AM UTC WPF 6
loading
Tags: DockingManager
Helmut Wahrmann
Asked On October 26, 2019 06:48 PM UTC

Hi,

i have a question on how to restore the original layout of a DockingManager.

I have set PersistState="True".
When now the various elements have been moved around and i want to restore the original layout of the program, how can i do that?

I have a button in my app, which executes a ResetState and a DeleteDockState, but the Layout stays the same.
Now when exiting the App, the layout is saved again, because of PeristState.

How could i achieve, what i want?

thanks,

Helmut

Helmut Wahrmann
Replied On October 27, 2019 08:42 AM UTC

Ok, i found now a way doing my own handling of saving and loading the state from an external file.

The only thing, which is not nice, is that i need code behind in my MVVM application to load the and save the states, since i need to reference the Dockingmanager by the name.
I haven't found how to handle this via Bindings.

Magesh Sankar [Syncfusion]
Replied On October 28, 2019 09:23 AM UTC

Hi Helmut, 
 
Thank for contacting Syncfusion support. 
 

We have checked your query ” Need to restore dock layout through binding”. Currently we are preparing the sample as per your requirement. We will update complete details on tomorrow 29/10/2019.

We appreciate your patience until then.

 
Regards 
  
Magesh S 


Niranjan Kumar Gopalan [Syncfusion]
Replied On October 30, 2019 03:32 AM UTC

Hi Helmut, 

Thanks for your patience with us. 

We are currently facing some technical difficulties in the sample we are working on your requirement. We will update you the sample on 31th Oct 2019. 

Regards, 

Niranjan Kumar G 


Kanniyappan Panneer Selvam [Syncfusion]
Replied On October 31, 2019 06:47 PM UTC

Hi Helmut, 
 
Thanks for your patience. 
 
We have checked your query "Perform Save and LoadDockState serialization in DockingManager using MVVM" and we can meet your requirement in MVVM pattern by using DockingManager interaction behaviors. The dock states can be saved and loaded by pressing Ctlr+S and Ctrl+L, respectively, using interaction behaviors only. Please find the code snippet, sample for the same.   
 
Code Snippet: 
 
View: 
 
<syncfusion:DockingManager x:Name="SyncDockingManager" Grid.Row="1" > 
            <interaction:Interaction.Behaviors> 
                <local:ViewModel/> 
            </interaction:Interaction.Behaviors> 
             
            <ContentControl x:Name="SolutionExplorer" syncfusion:DockingManager.Header="Solution Explorer" /> 
            <ContentControl x:Name="ToolBox" syncfusion:DockingManager.Header="Toolbox" /> 
            <ContentControl x:Name="Properties" syncfusion:DockingManager.Header="Properties" /> 
            <ContentControl x:Name="Output" syncfusion:DockingManager.Header="Output"/> 
            <ContentControl x:Name="StartPage" syncfusion:DockingManager.Header="Start Page" /> 
        </syncfusion:DockingManager> 
 
ViewModel: 
 
public class ViewModel : Behavior<UIElement> 
    { 
        protected override void OnAttached() 
        { 
            Window parent = Application.Current.MainWindow; 
            AssociatedObject.PreviewKeyDown += (sender, e) => 
            { 
                if (e.Key == Key.S && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))) 
                { 
                    (AssociatedObject as DockingManager).SaveDockState(); 
                } 
                if (e.Key == Key.L && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))) 
                { 
                    (AssociatedObject as DockingManager).LoadDockState(); 
                } 
            }; 
        } 
    } 
 
 
 
Please try the above solution and let us know if it is helpful. 
 
Regards, 
Kanniyappan P 


Helmut Wahrmann
Replied On November 1, 2019 09:17 AM UTC

Cool. thanks a lot for your answer.

Kanniyappan Panneer Selvam [Syncfusion]
Replied On November 4, 2019 05:35 AM UTC

Hi Helmut,  
  
Thanks for you update.  
  
We are glad to know that the reported issue has been resolved at your end. Please let us know if you need any further assistance on this. We are happy to help you.  
  
Regards,  
Kanniyappan P 



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon