ResetState or DeleteDockState
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
SIGN IN To post a reply.
6 Replies
HW
Helmut Wahrmann
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.
MS
Magesh Sankar
Syncfusion Team
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
NI
Ninja
Syncfusion Team
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
KP
Kanniyappan Panneer Selvam
Syncfusion Team
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
HW
Helmut Wahrmann
November 1, 2019 09:17 AM UTC
Cool. thanks a lot for your answer.
KP
Kanniyappan Panneer Selvam
Syncfusion Team
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
SIGN IN To post a reply.
- 6 Replies
- 4 Participants
-
HW Helmut Wahrmann
- Oct 26, 2019 06:48 PM UTC
- Nov 4, 2019 05:35 AM UTC