Restoring layout in DevExpress PivotGridControl in my WinForms project does not work

488 views Asked by At

I used following code to save and restore DevExpress PivotGridControl V7.2 layout:

//save layout
var fileName = string.Format(@"c:\pivot.xml");
pivotGridControl.SaveLayoutToXml(fileName);

//restore layout
var fileName = string.Format(@"c:\pivot.xml");
pivotGridControl.ForceInitialize();
pivotGridControl.RestoreLayoutFromXml(fileName);

But after running restore code, the layout doesn't change! Has my code any problem?

2

There are 2 answers

0
Masoud On BEST ANSWER

Thanks to Devexpress Support, following code, solved the problem:

pivotGridControl.OptionsLayout.Columns.RemoveOldColumns = false;

pivotGridControl.RetrieveFields();            
foreach (PivotGridField field in pivotGridControl.Fields) {
    field.Name = "field" + field.FieldName;
}
0
Ahmad Javadi Nezhad On

I'm not familiar with devexpress enough. But I suggest if you did not get a good answer. You can ask the question as a Ticket in the devexpress support section Devxpress Support