Is there anything that might prevent the SaveAsXml method from saving the band and column settings?
I'm calling the method at a point after InitializeLayout has run. For some grids, the SaveAsXml method saves all of the column data (position, size, etc). For some others, the exported XML file doesn't contain references to the BandsCollection, ColumnsCollection, or SortedColumnsCollection.
For the problem grid, the DataSource is bound at design time and the grid displays everything correctly when run. I tried both SaveAsXml(character) and SaveAsXml(character,PropertyCategories.All). In both cases, one grid I'm testing exports correctly, the other doesn't.
I checked at the point I'm calling the export and the grid has a bands collection (1 band) and the band has 17 columns. I've attached the two XML files. Any help would be greatly appreciated.
Regards,
Jim
Hi Jim,
I can't think of anything that would cause the grid to fail to save the layout. My guess would be that the grid didn't have any bands or columns at the time you called the Save method, but you already checked that.
Is it possible that some other place in your code is overwriting the same save file at some other point when the grid does not have bands or columns?
Can you duplicate this in a small sample project?
Thanks Mike,
The XML files I sent were copied immediately after the SaveAsXml method call. I created an empty temp file, called the SaveAsXml and then paused the program to get a snapshot of the xml file. Also, the temp file is created using a GUID so it's guaranteed to be unique.
I can try to create a sample, but the sample will not have the same level of complexity as the actual app. My thoughts are that it will work fine but I'll let you know.
Is there some other property I can test when the SaveAsXml call is made that could possibly show what's going on? I've already checked that the DataSource property is set, the DisplayLayout.Bands.Count is non-zero (1 in this case), and that the Bands.Items[0].Columns.Count is non zero.
Thanks,