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. Image for the cookie policy date

Loading dynamically added children

I am making a visual studio-style IDE in UWP and need to serialize the layout of the widgets. Using SaveDockState/LoadDockState always seems to mess up the layout when loading, by mixing up the positions or not even showing at all.

It's hard to understand this paragraph of the documentation

"Since the SfDockingManager state persistence feature implemented in such a way that the SfDockingManager matches the child collection of saved layout with current SfDockingManager layout internally and loads properly when SfDockingManager children collection remains same, so when any child collection changes dynamically, it results in an improper layout."

Does this refer to the order of elements in the child collection or any changes at all to the widget?

3 Replies

MS Marimuthu Sivalingam Syncfusion Team January 17, 2017 09:26 AM UTC

Hi Daniel,

Thank you for contacting Syncfusion support.

We have prepared the sample which tries to meet your requirement. In this sample we have used Save, Load, Reset Dock states of SfDockingManager to perform serialization operations. Please download the sample from the following link.

Sample: SfDockingSerialization

Query: "It's hard to understand this paragraph of the documentation"

SfDockingManager control loads the saved state of SfDockingManager correctly, when the children collection matches with the Saved state file. You can save and load the dynamically added children by changing its state until the application closes. Since after closing the application, the dynamically added children are removed from the children collection of DockingManager. So on loading it would result in an improper layout.

Please get back to us with more details if we have misunderstood your requirement.

Marimuthu S.

DA DanDev January 17, 2017 12:19 PM UTC

In the provided sample, if I drag the App.xaml.cs document and dock it to the bottom of the Mainwindow.xaml document, save the state, close the app, re-open the app, then load the state, it does not show up anymore.

"Since after closing the application, the dynamically added children are removed from the children collection of DockingManager."

I'm calling SaveLayout() in the OnSuspending override in my App class. The children are still in the collection at that point.
In OnSuspending:

I call SaveLayout()
I foreach through the children collection, adding their ViewModels to a list.
I then serialize the list with JSON.NET

When I load the app:
Deserialize the list of view models, adding their views to the Children collection.
call LoadLayout()

Sometimes this works, other times the the widgets mix up their places, other times nothing displays at all (even though they are in the children collection).

MS Marimuthu Sivalingam Syncfusion Team January 18, 2017 11:21 AM UTC

Hi Daniel,

Thank you for your update.

We were able to reproduce the issue and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates


Marimuthu S. 

Live Chat Icon For mobile
Up arrow icon