Saving and Restoring Column Information

Two methods GetColumnInformation and GetColumnInformation exposed for the user to save/retrieve

 column information.

Last edited Nov 18, 2012 at 1:12 PM by bpoojary, version 1


bpoojary Apr 10, 2013 at 8:06 PM 

Issue is fixed in revision number 23566.
I have added support for isVisible in colum information.

You dont have to deal with only visible columns as you did earlier and there is no need of extra code to set visiblilty of the column as you did earlier.

Please note: I am not getting emails for this page.


jmmooney Apr 10, 2013 at 12:57 PM 
bpoojary, I found errors in the saving and restoring of columns information. They are fixed in my code. In 23249. Calling GetColumnInformation would a serialized XML object of every single column, not just the visible columns. To fix this I added a to line 1204 in ExtendedDataGrid.cs 'Columns.Where(q=>q.IsVisible).Select(...'. This made it only serialize the columns that are shown on the datagrid.

Second, in ExtendedDataGrid.cs line ~1260. In SetColumnInformation(string xml), the ColumnInfo would set but the visibility of columns would not change. Maybe there is a bug deeper than I can see. Anyways, I added a few lines of code to set each columns visibility to 'Visible' if it was in ColumnInfo:
foreach (var column in Columns)
var results = ColumnInfo.Where(q => q.Header.ToString() == column.Header.ToString());

column.Visibility = results.Count() == 1 ? Visibility.Visible : Visibility.Hidden;