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

Saving only the root control with Persistence framework ?

2 Answers 66 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Yvan
Top achievements
Rank 1
Yvan asked on 22 May 2012, 04:06 PM
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 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 24 May 2012, 03:34 PM
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 >>

0
Yvan
Top achievements
Rank 1
answered on 24 May 2012, 06:17 PM
That's working!

Thanks TIna
Tags
PersistenceFramework
Asked by
Yvan
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Yvan
Top achievements
Rank 1
Share this question
or