Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
155
Some questions on how to serilize XamPivotGrid
posted

Hi,

I want to serialize XamPivotGrid layout as an XML stream and save it into database. Later on user could load this layout from database and display his pivot grid based on the saved layout. It seems that there is no associated methods for serializing PivotLayout as XML and deserializing the XML to PivotLayout object. I tried to use normal serialization but got some exceptions. Here is what I got. Can you please let me know when this function be added to XamPivotGrid or do you have any suggestions to work around this issue?

Thanks for your help. Our users definitely need this function be implemented in our product.

Joseph

=====================================================================

Case #1: Serialize PivotLayout

XmlSerializer serializer = new XmlSerializer(typeof(PivotGridLayout));

Got exception:

{"Infragistics.Controls.Grids.PivotGridLayout cannot be serialized because it does not have a parameterless constructor."}

----------------------------------------------------

Case #2: Serialize XamPivotGrid

XmlSerializer

 

 

serializer = new XmlSerializer(typeof(XamPivotGrid));

Got Exception:

There was an error reflecting type 'Infragistics.Controls.Grids.XamPivotGrid'.
{"Cannot serialize member 'System.Windows.Input.InputBinding.Command' of type 'System.Windows.Input.ICommand', see inner exception for more details."}
{"Cannot serialize member System.Windows.Input.InputBinding.Command of type System.Windows.Input.ICommand because it is an interface."}

 

 

 

 

Parents
No Data
Reply
  • 2050
    Suggested Answer
    Offline posted

    Hello,

    Please take a look at this sample. It shows how to save the layout of the pivotgrid to memory, how to serialize it to an xml file and how to binary serialize it to a database. It is tested to work both with the FlatDataSource and XMLADataSource, and the controls from the 10.3 release.

    In a few words, the PivotGrid does not support serialization out-of-the-box. What you need to do is create your own class that will hold all the important data from the PivotGrid in order to recreate the layout. In the sample the class that does that is called SavedPivotGridView. All of its properties are of primitive types and thus it is easily serializable.

    All the best,

    Atanas Dyulgerov

Children