Hello Telerik team,
Great work with the Persistence Framework! I have several questions though :)
1. Can I save and load multiple controls in the same stream? For example I want to save 2 TreeViews in the stream
2. I'm looking through your example with the 'Save' / 'Load' buttons and the GridView (http://demos.telerik.com/silverlight/beta/#PersistenceFramework/GridViewCustomSerialization). It's working fine with the Save/Load buttons when they are on the same page, but I want to do s.th. else. To save the state when the user leaves the page and to load it when he comes back
For some reason that code throws an error:
3. Can I use Persistence Framework to save the state of a DataFilter, i.e. I want to save the conditions of the DataFilter in a DB, to load these conditions in a stream and then load the DataFilter from that stream?
Great work with the Persistence Framework! I have several questions though :)
1. Can I save and load multiple controls in the same stream? For example I want to save 2 TreeViews in the stream
this
.stream =
this
.manager.Save(
this
.treeView1);
this
.stream =
this
.manager.Save(
this
.treeView2);
2. I'm looking through your example with the 'Save' / 'Load' buttons and the GridView (http://demos.telerik.com/silverlight/beta/#PersistenceFramework/GridViewCustomSerialization). It's working fine with the Save/Load buttons when they are on the same page, but I want to do s.th. else. To save the state when the user leaves the page and to load it when he comes back
//save the state when leaving the page
protected
override
void
OnNavigatedFrom(NavigationEventArgs e)
{
PersistenceManager manager =
new
PersistenceManager();
stream = manager.Save(
this
.radGridView1);
base
.OnNavigatedFrom(e);
}
//load when comes back again
protected
override
void
OnNavigatedTo(NavigationEventArgs e)
{
if
(stream !=
null
)
{
stream.Position = 0L;
PersistenceManager manager =
new
PersistenceManager();
manager.Load(
this
.radGridView1, stream);
}
}
For some reason that code throws an error:
" at Telerik.Windows.Controls.GridView.ColumnSortDescriptor.ToSortDescription()\r\n at Telerik.Windows.Data.SortDescriptorExtensions.AsSortDescription(ISortDescriptor sortDescriptor)\r\n at Telerik.Windows.Data.DataItemCollection.ConvertSortDescriptorToSortDescription(Object descriptor)\r\n at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n at Telerik.Windows.Data.ConvertingObservableCollectionManager.GetSourceItems(Object source, IEnumerable items)\r\n at Telerik.Windows.Data.ObservableCollectionManager.HandleCollectionChanged(IList sender, NotifyCollectionChangedEventArgs args)\r\n at Telerik.Windows.Data.ObservableCollectionManager.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args)\r\n at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args)\r\n at System.Collections.ObjectModel.ObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)\r\n at Telerik.Windows.Data.RadObservableCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)\r\n at Telerik.Windows.Data.ObservableItemCollection`1.OnCollectionChanged(NotifyCollectionChangedEventArgs e)\r\n at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)\r\n at Telerik.Windows.Data.RadObservableCollection`1.InsertItem(Int32 index, T item)\r\n at System.Collections.ObjectModel.Collection`1.Add(T item)\r\n at Silver.Presentation.Silverlight.GridViewCustomPropertyProvider.RestoreValue(CustomPropertyInfo customPropertyInfo, Object context, Object value)\r\n at Telerik.Windows.Persistence.Serialization.Deserializer.LoadProperties(ReferenceValue refValue, String path, Object obj)\r\n at Telerik.Windows.Persistence.Serialization.Deserializer.Deserialize(ReferenceValue refValue, Object obj)\r\n at Telerik.Windows.Persistence.Serialization.Deserializer.Deserialize(Stream stream, Object objectToDeserialize)\r\n at Telerik.Windows.Persistence.PersistenceManager.Load(Object obj, Stream stream)\r\n at Silver.Presentation.Silverlight.TestPage.OnNavigatedTo(NavigationEventArgs e)"
3. Can I use Persistence Framework to save the state of a DataFilter, i.e. I want to save the conditions of the DataFilter in a DB, to load these conditions in a stream and then load the DataFilter from that stream?