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
1190
XAMGrid using PersistanceManager save colums when new column is added
posted

I am saving the columns of a XAMGrid using the persistance manager.  If I add a new column to the grid and then load the settings back in, the new columns are no longer there and cannot be shown.

Parents
  • 28407
    posted

    HI Edwin,

     You could wire up the PersistenceSettings' Objects' Loaded Event. In that event you could add the new columns.

     Here is a code snippet:
     

    ObservableCollection<Person> people = new ObservableCollection<Person>();    

         PersistenceGroup _SettingsGroup;

           PersistenceSettings settings;

             string fileName = "TEST";  

                 public MainPage()      

       {    

             InitializeComponent();  

               _SettingsGroup = (PersistenceGroup) LayoutRoot.Resources["SETTINGS"] as PersistenceGroup;

                settings = (PersistenceSettings)LayoutRoot.Resources["ColumnSettings"] as PersistenceSettings;     

            settings.Events.PersistenceSaved += new EventHandler<PersistenceSavedEventArgs>(Events_PersistenceSaved);

                settings.Events.PersistenceLoaded += new EventHandler<PersistenceLoadedEventArgs>(Events_PersistenceLoaded);

            }

            void Events_PersistenceLoaded(object sender, PersistenceLoadedEventArgs e)

            {  

               //throw new NotImplementedException();

                 foreach (Column c in xgrid1.Columns)  

               {

                     int i = int.Parse(c.Tag.ToString());

                      xgrid1.Columns.Remove(c);

                    xgrid1.Columns.Insert(i, c);

                }

            }

     Sincerely,

     Matt
    Developer Support Engineer

     

Reply Children