<
telerik:RadTreeView
x:Name
=
"treeView"
>
<
telerik:RadTreeViewItem
Header
=
"Beverages"
>
<
telerik:RadTreeViewItem
Header
=
"Chai"
/>
<
telerik:RadTreeViewItem
Header
=
"Chang"
/>
<
telerik:RadTreeViewItem
Header
=
"Ipoh Coffee"
/>
<
telerik:RadTreeViewItem
Header
=
"Chartreuse verte"
/>
<
telerik:RadTreeViewItem
Header
=
"Sasquatch Ale"
/>
</
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Condiments"
>
<
telerik:RadTreeViewItem
Header
=
"Aniseed Syrup"
/>
<
telerik:RadTreeViewItem
Header
=
"Genen Shouyu"
/>
<
telerik:RadTreeViewItem
Header
=
"Gula Malacca"
/>
<
telerik:RadTreeViewItem
Header
=
"Louisiana Hot Spiced Okra"
/>
<
telerik:RadTreeViewItem
Header
=
"Louisiana Fiery Hot Pepper Sauce"
/>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeView
>
private
Stream stream;
private
PersistenceManager manager =
new
PersistenceManager();
private
void
Save()
{
this
.stream =
this
.manager.Save(
this
.treeView);
}
private
void
Load()
{
this
.stream.Position = 0L;
this
.manager.Load(
this
.treeView,
this
.stream);
}
SaveToStorage() - the method that saves the UIElement properties in the associated file in the isolated storage
LoadFromStorage() - the method that loads the persisted properties from the UIElement's associated file
<
telerik:RadTreeView
x:Name
=
"treeView"
telerik:PersistenceManager.StorageId
=
"treeView"
>
<
telerik:RadTreeViewItem
Header
=
"Beverages"
>
<
telerik:RadTreeViewItem
Header
=
"Chai"
/>
<
telerik:RadTreeViewItem
Header
=
"Chang"
/>
<
telerik:RadTreeViewItem
Header
=
"Ipoh Coffee"
/>
<
telerik:RadTreeViewItem
Header
=
"Chartreuse verte"
/>
<
telerik:RadTreeViewItem
Header
=
"Sasquatch Ale"
/>
</
telerik:RadTreeViewItem
>
<
telerik:RadTreeViewItem
Header
=
"Condiments"
>
<
telerik:RadTreeViewItem
Header
=
"Aniseed Syrup"
/>
<
telerik:RadTreeViewItem
Header
=
"Genen Shouyu"
/>
<
telerik:RadTreeViewItem
Header
=
"Gula Malacca"
/>
<
telerik:RadTreeViewItem
Header
=
"Louisiana Hot Spiced Okra"
/>
<
telerik:RadTreeViewItem
Header
=
"Louisiana Fiery Hot Pepper Sauce"
/>
</
telerik:RadTreeViewItem
>
</
telerik:RadTreeView
>
private
IsolatedStorageProvider isoProvider =
new
IsolatedStorageProvider();
private
void
Save()
{
this
.isoProvider.SaveToStorage();
}
private
void
Load()
{
this
.isoProvider.LoadFromStorage();
}
To learn more about the Persistence Framework, please visit its documentation page, online examples or simply get the beta bits and play with them. Any feedback would be greatly appreciated.
PS: Here you can download the sample application demonstrating the scenarios described in this blog post.