NOTE: This example was created for older XtraPivotGrid versions. The demonstrated solution is appropriate for versions prior to v2011.1.
Generally, to serialize a property of the DevExpress control, it is enough to mark it with the XtraSerializableProperty attribute (see How to serialize a custom property of the DevExpress control's descendant). However, this approach will not work in PivotGridControl since the PivotGridData object, not the PivotGridControl itself, is serialized. So, to accomplish this task, it is required to define the property in PivotGridData, and refer to this property in PivotGridControl. Please see the example's code to see how this should be implemented.
Starting with version 11.1, it is sufficient to decorate properties declared in the PivotGridControl descendant with the XtraSerializableProperty attribute:
[C#]publicclassMyPivotGrid:PivotGridControl,IXtraSupportDeserializeCollectionItem{privateList<Class1>_Objects=newList<Class1>();[XtraSerializableProperty(XtraSerializationVisibility.Collection,true)]publicList<Class1>Objects{get{return_Objects;}}privateClass1_Object=newClass1();[XtraSerializableProperty(XtraSerializationVisibility.Content)]publicClass1Object{get{return_Object;}}#region IXtraSupportDeserializeCollectionItem MembersobjectIXtraSupportDeserializeCollectionItem.CreateCollectionItem(stringpropertyName,XtraItemEventArgse){if(propertyName=="Objects"){Class1class1=newClass1();Objects.Add(class1);returnclass1;}elsereturnnull;}voidIXtraSupportDeserializeCollectionItem.SetIndexCollectionItem(stringpropertyName,XtraSetItemIndexEventArgse){}#endregion}