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

Problem storing RadGridView and RadDocking together to Isolated Storage

7 Answers 170 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Bryce
Top achievements
Rank 1
Bryce asked on 05 Apr 2012, 09:32 PM
Hi,

I have a problem storing both RadGridView and RadDocking to IsolatedStorage. When I just have the grid it works fine, but when I add in the docking it doesn't work. I copied the demos online with the CustomProperties, but it still isn't working use both of them. I have a storage id for RadDocking with serialization tags for both panes, and I have a storage id for the grid.

For the grid I have:

ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(typeof(RadGridView), new GridViewCustomPropertyProvider());
Application.Current.Exit += (_, __) =>
                                            {
                                                try
                                                {
                                                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                                                    {
                                                        // 0.1 MB of isolated storage space is needed
                                                        var spaceNeeded = 1024*1024*0.1;
                                                        if (store.AvailableFreeSpace < spaceNeeded)
                                                        {
                                                            store.Remove();
                                                        }
 
                                                        IsolatedStorageProvider provider = new IsolatedStorageProvider();
                                                        provider.SaveToStorage();
                                                    }
                                                }catch(IsolatedStorageException){}
                                            };
 
            radGridView.Loaded += (_, __) =>
                                      {
 
                                          try
                                          {
                                              using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                                              {
                                                  // 0.1 MB of isolated storage space is needed
                                                  var spaceNeeded = 1024 * 1024 * 0.3;
                                                  if (store.AvailableFreeSpace < spaceNeeded)
                                                  {
                                                      store.Remove();
                                                  }
                                              }
 
                                              IsolatedStorageProvider provider = new IsolatedStorageProvider();
                                              provider.LoadFromStorage();
                                          }
                                          catch (IsolatedStorageException)
                                          {
                                          }
                                      };
 
This works for when the user loads the grid, the data is loaded. However if I do something similar for RadDocking, it doesn't remember:

ServiceProvider.RegisterPersistenceProvider<ICustomPropertyProvider>(typeof(RadDocking), new DockingCustomPropertyProvider());
 
 
            Application.Current.Exit += (_, __) =>
            {
                try
                {
                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        // 0.1 MB of isolated storage space is needed
                        var spaceNeeded = 1024 * 1024 * 0.1;
                        if (store.AvailableFreeSpace < spaceNeeded)
                        {
                            store.Remove();
                        }
 
                        IsolatedStorageProvider provider = new IsolatedStorageProvider();
                        provider.SaveToStorage();
                    }
                }
                catch (IsolatedStorageException) { }
            };
 
            radDocking.Loaded += (_, __) =>
            {
 
                try
                {
                    using (var store = IsolatedStorageFile.GetUserStoreForApplication())
                    {
                        // 0.1 MB of isolated storage space is needed
                        var spaceNeeded = 1024 * 1024 * 0.3;
                        if (store.AvailableFreeSpace < spaceNeeded)
                        {
                            store.Remove();
                        }
                    }
 
                    IsolatedStorageProvider provider = new IsolatedStorageProvider();
                    provider.LoadFromStorage();
                }
                catch (IsolatedStorageException)
                {
                }
            };


If I could get an attachment of a project demonstrating how to store both when both load at different times from IsolatedStorage, that would be great.

[edit]The grid doesnt remember anything and the docking control literally blinks when they both are in my solution[/edit]

Oh yea, I forgot to mention I am using the RadGridView in one of the panes that in the documenthost.
Thanks,
Bryce

7 Answers, 1 is accepted

Sort by
0
Accepted
Tina Stancheva
Telerik team
answered on 10 Apr 2012, 02:51 PM
Hello Bryce,

I attached a sample demonstrating how to persist a layout containing both RadDocking and RadGridView. However, please keep in mind that:
  • The RadGridView persisted data has to be loaded only after the control and its data are fully initialized. This is why in the sample application I loaded the GridView persisted data in a dispatcher after loading the RadGridView.
  • The RadDocking custom property provider in our demo samples (and in the sample solution I attached) persists the Content property of the Docking. This is why the RadGridView control as part of the Docking content will be persisted by the Docking persistence logic. However as the Docking saved data can be loaded as soon as the application has loaded, and the GridView cannot, it's best to persist the RadGridView on its own. I order to do so, you can exclude the Content property from the DockingCustomPropertyProvider.GetCustomProperties() method. Or you can wrap the RadGridView in another panel - for example a Grid control and define SerializationOptions that exclude the Grid.Children property from the persisted properties of the Grid. I used the second approach in the attached sample.

I hope the information and the sample solution will get you started but please let me know if I can further assist you.

Regards,
Tina Stancheva
the Telerik team

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

0
Deepak
Top achievements
Rank 1
answered on 26 Feb 2013, 01:12 PM
Hi Guys,
   Please help,,,
   I have a radgridview and its columnsorting is enabled. Now when I click on the header of the column to which i need to sort, it is sorting in Ascending,Descending and no sort. Is there a way to disable this no sort so that I can have sorting  as ascending and descending only??

Regards,
Deepak
0
saw
Top achievements
Rank 1
answered on 15 Jul 2014, 09:13 AM
I'm using MVVM in my project. MainPage.xaml has RadDocking,RadSplitContainer,RadPaneGroup and RadPane. Another module has Contact.xaml and in side it RadGridView. I'm loading Contact.xaml into ContentControl behind the code. I use your code appropriately in my scenario. But, it raised errors when loading Grid content, at the "First Time" project runs. In "GridViewCustomPropertyProvider", "RestoreValue" method's "savedProxies" has "null" value. While i'm continue the project finally it hit my "OnPropertyChanged" (PropertyChangedEventHandler) this cause project crash. Then nothing on screen.

My main consideration is why  "savedProxies" has null value ? Any work around available for this ?

0
Zarko
Telerik team
answered on 17 Jul 2014, 09:03 AM
Hi saw,
Unfortunately we weren't able to reproduce the issue so I'd like to ask you for a sample project (you could use the project from Tina's reply and try to modify it) or at least some code snippets so that we could investigate the problem on our side. Also I'd like to ask for your exact dll version and whether you're using Silverlight or WPF.
You should also check what the "ProvideValue" method in your GridViewCustomPropertyProvider returns.
We're looking forward to hearing from you.

Regards,
Zarko
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Dustin
Top achievements
Rank 1
answered on 16 Jan 2015, 06:45 PM
Hi Tina,

I'm attempting to use the method you showed in your example to accomplish the same task (persist RadGridView state along with RadDocking) and am running into some problems.  The panels' states are getting stored successfully, however, the RadGridView column order is not.  When I debug the GridViewCustomPropertyProvider.ProvideValue method during serialization, I notice that every single GridViewColumn's DisplayIndex property is set to -1.  

Any ideas?  I am using UI for WPF Q2 2014 in my project.

Thanks,
Dustin
0
Dustin
Top achievements
Rank 1
answered on 16 Jan 2015, 10:11 PM
It appears that the problem stemmed from the fact that my RadGridView was inside a UserControl, and there were several instances of the UserControl in my application.  Thus, the PersistanceManager.StorageId for the RadGridViews was not unique.  I solved this issue by programmatically setting each RadGridView's StorageId when a new UserControl was instantiated (keeping a static count of the number of instances and appending this to some const string value).  
0
Zarko
Telerik team
answered on 20 Jan 2015, 12:22 PM
Hi Dustin,
We're glad you were able to fix the issue and yes - by default the StorageId should be unique for each visual element that you want to save.
If you have any other questions feel free to ask.

Regards,
Zarko
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
PersistenceFramework
Asked by
Bryce
Top achievements
Rank 1
Answers by
Tina Stancheva
Telerik team
Deepak
Top achievements
Rank 1
saw
Top achievements
Rank 1
Zarko
Telerik team
Dustin
Top achievements
Rank 1
Share this question
or