This is a migrated thread and some comments may be shown as answers.

RadDocking Serialization/SaveLayout not properly working

3 Answers 139 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Andreas
Top achievements
Rank 1
Andreas asked on 12 Apr 2013, 02:39 PM
Hello there,

I got a problem with saving and loading the current state of my RadDocking generated with a dynamic DataSource.

I bind the list of a data class to the RadDocking or a custom inheritance of it. You can see a few samples in the project assembly.
I have included the Telerik Persistance Framework and the SharpSerializer to save the grid in a data storage (for example: IsolatedStorage)

You can start the project to see what happens, you can change the custom docking elemetn in the MainPage.xaml with the commented one.


------------------------------
In case that you still not get what i mean, the minimum requirements on the product are:
- A list of data (filled with dynamic values) in the ViewModel
- It should save and load the states of the RadDocking if required (e.g.: with 2 dynamic ChartViews and 1 GridView or with 1 GridView and any other Control in RadPanes) and provide it to the ViewModel
- In every RadPane there should be the DataTemplate for the kind of view the customer want (e.g.: A ChartView or a GridView of the data)

The key thing is, that the content of the RadPane depends on the DataTemplate and on the data itself collected in a data class.
A List of Both are bound to the ItemSource Property of the RadDockingExtension which creates a RadPane for every data class and applies the ContentTemplate of it.

If you load the RadDocking it should get back the last state or one of many saved in a DataStorage. The data class should get updated. For testing purposes we will fix the list of the data class to a specific amount of elements (e.g: 3 items) and the same element with new information will always be on the same index, later we could use a Dictionary or something similar.

It is really nessecary to save the state of the RadDocking to a database or a File, the IsolatedStorage is only a example for testing purposes.

Best regards
Andreas


https://docs.google.com/file/d/0B2Gh-Fj36cJKTEFDckgxX2hTemM/edit?usp=sharing
File => Download || Datei -> Herunterladen

3 Answers, 1 is accepted

Sort by
0
Andreas
Top achievements
Rank 1
answered on 16 Apr 2013, 08:38 AM
There is a simple failure in the ElementSerializationDocking:
        private static void OnByteArrayChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ...
                (d as SharpSerializationDocking).LoadLayout(ms);
            ...
        }

should be:
        private static void OnByteArrayChange(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            ...
                (d as ElementSerializationDocking).LoadLayout(ms);
            ...
        }

Then you get what i mean with your recommended approach for saving and loading states, if its possible, you have to skip the OnByteArrayChange the first time it will be called, i will fix this later.

I will get the other examples also to work as far as i can. because nothing works all the time.
0
Accepted
Ivo
Telerik team
answered on 18 Apr 2013, 05:37 PM
Hi Andreas,

RadDocking provides its own method for saving and loading its layout - SaveLayout and LoadLayout. Into your case the PersistanceFramework can help you to save and load the headers of RadPanes, because they are complex object. I prepared a sample project that demonstrates how to save and load RadDocking's layout and the headers of RadPanes using PersistanceFramework.

Greetings,
Ivo
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Andreas
Top achievements
Rank 1
answered on 24 Apr 2013, 12:20 PM
Hello,

thank you, I have worked with the sample and it worked as expected! I'm very satisfied with it.

Best regards
Andreas
Tags
Docking
Asked by
Andreas
Top achievements
Rank 1
Answers by
Andreas
Top achievements
Rank 1
Ivo
Telerik team
Share this question
or