Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
220
XamGrid Settings Not Loading in v.13.2
posted

I am trying to persist user-initiated column settings, specifically moved columns and column resizing. The file I specify in code is written to the proper location, but either the settings are not being saved in the file or the settings are not being loaded from the file. Any help would be greatly appreciated.  I have even tried running a number of samples posted to this forum by replacing the refrences with version 13.2, but even the samples won't persist the settings.  Here is the relevant code from my project:

 

XAML:

<ig:XamGrid.ColumnMovingSettings>
  <ig:ColumnMovingSettings AllowColumnMoving="Indicator"/>
</ig:XamGrid.ColumnMovingSettings>

<ig:PersistenceManager.Settings>
 <ig:PersistenceSettings SavePersistenceOptions="OnlySpecified" LoadPersistenceOptions="AllButIgnored">
  <ig:PersistenceSettings.PropertySettings>
   <ig:PropertyNamePersistenceInfo PropertyName="ColumnResizingSettings"/>
   <ig:PropertyNamePersistenceInfo PropertyName="ColumnMovingSettings"/>
  </ig:PersistenceSettings.PropertySettings>
 </ig:PersistenceSettings>
</ig:PersistenceManager.Settings>

CODE-BEHIND

#region ' Test Persistence'

private const string FILE_GRIDSETTINGS = "grid_settings.xml";

void MyWorkQueue_Loaded(object sender, RoutedEventArgs e)
{  LoadGridSettings(grid, FILE_GRIDSETTINGS); }

public void SaveSettings()
{  SaveGridSettings(GridWorkQueue, FILE_GRIDSETTINGS); }

private void SaveGridSettings(DependencyObject grid, string fileName)
{
 MemoryStream memoryStream = PersistenceManager.Save(grid);

 using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
 {
  if (iso.FileExists(fileName))
   iso.DeleteFile(fileName);

  using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(fileName, FileMode.OpenOrCreate, iso))
  {    stream.Write(memoryStream.ToArray(), 0, (int)memoryStream.Length);   }  } }

private void LoadGridSettings(DependencyObject grid, string fileName)
{
 using (IsolatedStorageFile iso = IsolatedStorageFile.GetUserStoreForApplication())
 {   if (iso.FileExists(fileName))
  {    using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream(fileName, FileMode.OpenOrCreate, iso))
   {     PersistenceManager.Load(grid, stream);    }   }  } }

private void GridWorkQueue_ColumnDropped(object sender, Infragistics.Controls.Grids.ColumnDroppedEventArgs e)
{  SaveSettings(); }

#endregion

 

Any help of suggestions would be greatly appreciated.

  • 138253
    Offline posted

    Hello,

     

    I am just checking the progress of this issue and was wondering if you managed to achieve your goal or if you need any further assistance on the matter.

  • 138253
    Offline posted

    Hello,

     

    Thank you for your post. I have been looking into it and I can suggest you see this forum thread:

     

    http://es.infragistics.com/community/forums/p/80435/405971.aspx

     

    where there is a sample showing how to save the Column’s Width, Sort direction, index, etc. The Properties you save (ColumnResizingSettings and ColumnMovingSettings) are for allowing the moving and resizing. Please let me know if this helps you or you have further questions on this matter.

     

    Looking forward for your reply.