If a child record is not expanded in a datagrid, SaveCustomizations return the default widths, not the widths that were set with LoadCustomizations. If the child record is expanded by the user, the loaded widths will be returned.
Hello,
I reproduced the scenario and it works fine with me or at least what I think you mean.
Please attach a sample project with your next post to see what scenario and maybe give me some steps to reproduce.
Alex.
I should be easy to reproduce.
1. Open the child record.
2. Modify the width of a field in the child record.
3. Do the savecustomizations and write to a file. The file should have the new field width in it
4. Close the window.
5. restart the app and do a loadCustomizations from the file created in #3.
6. DO NOT open a child record..
7. Do the savecustomizations and write to a file. The file WILL NOT have the new field width in it.
If you cannot dup it, can you send me your project? Maybe I'll be able to spot the difference. It should be faster than me packaging a small project to send to you.
Thanks...
This time I reproduced it. It looks like a bug. I will consult with the QA team to verify my opinion and will post a follow up here.
Great!
BTW there seems to be another related problem with fields and child records. If you rearrange fields then try to open a child record the datapresenter will crash with a null reference.
We are not sure if this is expected behavior or not. Our explanation for this is when you restart the application the child layout has not been created ( as it has not been expanded at least once ) so that is why it does not save its customizations. As a workaournd I would suggest this -- (expand the record before saving ) :
if (xamDataGrid1.Records[0].IsExpanded == true) { using (FileStream fs = new FileStream("xamDataGridLayout1.xml", FileMode.Create, FileAccess.Write)) { this.xamDataGrid1.SaveCustomizations(fs); } } else { using (FileStream fs = new FileStream("xamDataGridLayout1.xml", FileMode.Create, FileAccess.Write)) { this.xamDataGrid1.SaveCustomizations(fs); } xamDataGrid1.Records[0].IsExpanded = false; }
I can't imagine it's expected behavior. I had thought of doing something like you workaround. but not every record has a child record.
Maybe I'll parse the string from saveCustomizations and merge it with the 'good' one.