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

Storing Items Property

1 Answer 61 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Mike
Top achievements
Rank 2
Mike asked on 30 Aug 2011, 10:15 AM
Hi,

i was wondering if it is possilbe to save the item's property of an element using the persistence framework.
To be exact, i have a tileview with an itemssource bound to a collection of inside my viewmodel and i want to save the items and the position of the items.

1 Answer, 1 is accepted

Sort by
0
Alex Fidanov
Telerik team
answered on 30 Aug 2011, 05:28 PM
Hi Michael,

By default, the PersistenceFramework uses a serializer that reads and saves the values of the UI-related properties. The ItemsSource property of the ItemsControls, contains business objects and by default they are omitted. However, you can change this by using the full serializer instead. You can do this by subclassing the PersistenceManager and overriding the GetSerializerOverride method:

public class MyPersistenceManager : Telerik.Windows.Persistence.PersistenceManager
{
    protected override Telerik.Windows.Persistence.Serialization.ISerializer GetSerializerOverride()
    {
        return new Telerik.Windows.Persistence.Serialization.Serializer(this);
    }
}
Generally, I would not recommend using this approach, unless you really need to save your business objects. What you can do as an alternative, is to register a custom property provider and plug in into the serialization process in this manner.

You can see some sample custom property providers in our online demos for the GridView and Docking controls. Please let me know if you need further assistance in creating a custom provider.

Regards,
Alex Fidanov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
PersistenceFramework
Asked by
Mike
Top achievements
Rank 2
Answers by
Alex Fidanov
Telerik team
Share this question
or