Hi There,
We would like to leverage Ultragridlayout.SaveToXML/LoadFromXML to preserve user defined column widths, positions and sorting. If I use PropertyCategories.All for SaveToXML , any subsequent changes to the grid like adding/removing columns are not shown and throws an error randomly.
1) Ideally I would like to preserve ONLY columns widths, positions and sorting. Should I be using some other value or combinations of values for PropertyCategories???
2) Is there a builtin method to reset the grid settings to its defaults?
Thanks,
Ramesh
Hi Ramesh,
rtumati said:1) Ideally I would like to preserve ONLY columns widths, positions and sorting. Should I be using some other value or combinations of values for PropertyCategories???
I don't think there are any options that will allow you to save the position and width of columns and not save the hidden state.
What I would do is load the layout, then hide the columns in code after tha layout has already been loaded.
rtumati said:2) Is there a builtin method to reset the grid settings to its defaults?
grid.DisplayLayout.Reset will reset the grid to the defaults. But these might not be the same defaults you see when you put a new grid on a form, because the grid designer also loads a default preset into the grid. This is optional, and you could turn it off or change the preset, but you probably haven't done so. So you might want to load the same preset into the grid to return it to the default state you had at design-time.
To load a preset into the grid, you would use the PresetSerializer class which has static methods to load presets.
Is there a way to combine several of the PropertyCategories in the .DisplayLayout.SaveAsXml call like ColumnFilters and Groups?
Also, can one dig into the General setting to specify specifics from within what the setting saves, like CaptionAppearance, Appearance, BorderStyleCaption, etc?
Hi Scott,
Yes, you just 'Or' them together.
In C#:
ColumnFilters | Groups
In VB:
ColumnFilters Or Groups