This question is locked. New answers and comments are not allowed.
Hi,
I used the GridViewCustomPropertyProvider sample which is nice thanks.
The problem is to store those settings into IsolatedStorage...
Is there an easy way I have missed?
I had to create myself a function to copy the stream from one object to the other. I'm sure there is a way so obvious that you don't talk about anywhere ;)
For people wondering, I'm calling the load in UserControl_Loaded and I save in various events like ColumnReordered, ColumnWidthChanged, Grouped, Filtered and Sorted.
Thank you for your lights,
John.
I used the GridViewCustomPropertyProvider sample which is nice thanks.
The problem is to store those settings into IsolatedStorage...
Is there an easy way I have missed?
I had to create myself a function to copy the stream from one object to the other. I'm sure there is a way so obvious that you don't talk about anywhere ;)
For people wondering, I'm calling the load in UserControl_Loaded and I save in various events like ColumnReordered, ColumnWidthChanged, Grouped, Filtered and Sorted.
Thank you for your lights,
John.
private void Save() { // Obtain the isolated storage for an application. using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { //IsolatedStorageFileStream s = store.OpenFile(@"GridsCommand.txt", FileMode.Create, FileAccess.Write); using (Stream stream = new IsolatedStorageFileStream(@"GridsCommand.txt", FileMode.Create, FileAccess.Write, store)) { if (stream != null) { PersistenceManager manager = new PersistenceManager(); Stream str = manager.Save(this.grdBeneficiaire); CopyStream(str, stream); } } } } public static void CopyStream(Stream input, Stream output) { byte[] buffer = new byte[8 * 1024]; int len; while ((len = input.Read(buffer, 0, buffer.Length)) > 0) { output.Write(buffer, 0, len); } } private void Load() { // Obtain the isolated storage for an application. using (var store = IsolatedStorageFile.GetUserStoreForApplication()) { if (store.FileExists("GridsCommand.txt")) { using (Stream stream = new IsolatedStorageFileStream(@"GridsCommand.txt", FileMode.Open, FileAccess.Read, store)) { if (stream != null) { PersistenceManager manager = new PersistenceManager(); manager.Load(this.grdBeneficiaire, stream); } } } } }