I am trying to export the settings of a grid to an XML file. I used grid.DisplayLayout.SaveAsXML. However it was not exporting everything. When I used the grid.DisplayLayout.LoadFromXML to restore the settings, it just doesn't look the same.
Is there any other ways to do what I want? Thanks.
I found the problem. When I saved the layout, I mistakenly used another grid, so the layout saved is not of the same grid to be restored. That's why all header settings are lost.
As a matter of fact, the data source is the same as the one before the layout is saved. The reason why it doesn't looks the same is because in the 1st screen shot, the header of each column has a display name and in the 2nd screen shot, these settings lost and it is displaying the original header of the data table in the data source.
It does not appear that the grid's data source is the same in the second screen shot. It's hard to tell, because the column headers are clipped in the second image, but none of the headers seem to match up to the headers in the first screen shot.
The Layout is schema-specific. This means you can only load a layout into a grid that is using exactly the same schema for which the layout was saved. If you are trying to change the grid's data source to something completely different from the original schema, then you will not be able to load a layout saved with a different schema.
SaveLayout and LoadLayout are really intended to allow you to save user-customizable settings such as the position and width of columns, sorting, filters, etc.
If you want to save settings that are not really user-customizable, such as AutoFitStyle or the display of the Filter Row, then you might want to consider using a Preset, instead of a Layout. To save and load presets at run-time, you would use the PresetSerializer class.
Sry~ typed in the wrong url...
Before
After
As far as I can tell, It didn't export the AutoFilt Style, and it lost all the heading setting (Display text etc.)
Thanks.
Hi,
Did you forget to post the screen shots? Or did you figure it out? :)