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."}
I found the problem, the Fill method doesn't take the order of the row, column, or filter hierarchies into account when it reconstructs the view.
Hi, I followed the example in the sample you posted, but when I load a saved layout into the grid, it doesn't preserve the order of the columns or rows, it puts them in alphabetical order. For example, if define the hierarchy as Year -> Month -> Day, when I load that layout back, it becomes Day -> Month -> Year. Do you know what could be causing this?
I solved my issue myself by rethinking it all over.
I guess that I was thinking to complicated (I was experimenting with RX Extensions and Async CTP as well), but I solved it by letting the Thread sleep as long as FilterMembers = null (the data still being fetched on the background).
if (filterViewModel != null) { while (filterViewModel.FilterMembers == null) System.Threading.Thread.Sleep(100); if (filterViewModel.FilterMembers != null) foreach (IFilterMember filterMember in filterViewModel.FilterMembers) ExpandMembers(filterViewModel, filterMember); }
Hi Atanas,
Thanks for your sample, but it's not working for me. I'm using the XMLADataSource with a Custom Provider, as decribed in http://community.infragistics.com/blogs/engineering/archive/2010/10/26/building-a-custom-data-provider-for-xampivotgrid-in-silverlight-using-wcf-and-adomd-net.aspx
The problem is that the levels are not getting expanded.
This is how my data source looks:
<igOlap:XmlaDataSource x:Key="DataSource" >
<igOlap:XmlaDataSource.ConnectionSettings> <CustomDataProvider:AdomdConnectionSettings ConnectionString="<my connection string>" /> </igOlap:XmlaDataSource.ConnectionSettings>
</igOlap:XmlaDataSource>
Your support would be greatly appreciated. I'm pretty stuck with this for a few days.
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