Storing Items Property

2 posts, 0 answers
  1. Mike
    Mike avatar
    39 posts
    Member since:
    May 2011

    Posted 30 Aug 2011 Link to this post

    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.
  2. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 30 Aug 2011 Link to this post

    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 >>

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top