Saving only the root control with Persistence framework ?

3 posts, 0 answers
  1. Yvan
    Yvan avatar
    16 posts
    Member since:
    Sep 2007

    Posted 22 May 2012 Link to this post

    Hi,

    It is possible to persist with only the root object with the Persistence Framework ?
    I have a RadExpander with many controls into it. I only want to persist the RadExpander control properties (like IsExpanded, IsEnabled), not is children controls.

    For example, I want to persist IsExpanded property, not the two textboxes controls:
    <telerik:RadExpander x:Name="expander" Header="My Header" IsExpanded="True" >
       <StackPanel Orientation="Vertical">
           <TextBox Text="{Binding ExampleBinding1}" />
           <TextBox Text="{Binding ExampleBinding1}" />
       </StackPanel>
    </telerik:RadExpander>

    It is possible ?

    Thanks

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 24 May 2012 Link to this post

    Hi Yvan,

    You can define the PersistenceManager.SerializationOptions to control which properties of the RadExpander to be persisted. This article can give you more information about this property and how you can use it.

    Basically in your case you can exclude the Content property from the RadExpander properties that will be persisted:
    <telerik:RadExpander x:Name="expander" Header="My Header" IsExpanded="True" >
        <telerik:PersistenceManager.SerializationOptions>
          <telerik:SerializationMetadataCollection>
          <telerik:PropertyNameMetadata Condition="Except" Expression="Content" SearchType="PropertyName" />
        </telerik:SerializationMetadataCollection>
        <StackPanel Orientation="Vertical">
          <TextBox Text="{Binding ExampleBinding1}" />
          <TextBox Text="{Binding ExampleBinding1}" />
        </StackPanel>
    </telerik:RadExpander>

    Give this a try and let me know if it helps or if we can further assist you.

    Greetings,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Yvan
    Yvan avatar
    16 posts
    Member since:
    Sep 2007

    Posted 24 May 2012 Link to this post

    That's working!

    Thanks TIna
Back to Top