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,
Hi Reto,
It's impossible for me to guess if this is the same issue, but it sounds like it might be. The best thing for you to do is get the latest service release and see if it fixes the issue. I suspect it will.
If not, we can certainly look into it.
Hi Mike,
where can I get information about the latest service release?
Reto
My Infragistics Keys and Downloads - Download Anything and Everything You Own
I have installed the latest service release and it does not fix it. E.g. my version is:Infragistics2.Win.UltraWinGrid.v9.1\9.1.20091.2039
If I have a grid, then group by a column and do a SaveAsXML and immediately reload the output using LoadAsXML, the grouping is destroyed.
Can you please have a look at this?
Regards,Reto
I just tested this out and it's working fine for me. I am attaching the sample project I used here so you can try it out.
Just run the sample, drag any column into the GroupByBox, then press the buttons in order from top top bottom to save, reset, and then re-load the layout.
thanks for the sample project. I finally found the reason for the behaviour.
I use DataBinding with a BindingList. Then on the UltraGridColumn, the GroupByMode was not set (therefore set to Default). This worked fine if I load the grid with the data and manipulate it, e.g. do grouping. But when call SaveAsXml and LoadAsXml (and no GroupByMode set), then the grouping does not work correctly anymore after LoadAsXml was called. It may have do to something with the bound object types tough.
If I set the GroupByMode to Text, then it always works, so I am going to use that.