Hi, In my proect I have to save the pivot grid view in an xml file and load it from the xml. I make it like the following example.
https://ko.infragistics.com/samples/silverlight/pivot-grid/#/save-and-load-views
There is only one diffrence that I take the XML information from another page with the URL. And read it like following lines.
SavedPivotGridView XMLSerializedView = new SavedPivotGridView();
XmlSerializer serializer = new XmlSerializer(typeof(SavedPivotGridView)); StringReader stringReader = new StringReader(QueryResult); XMLSerializedView = (SavedPivotGridView)serializer.Deserialize(stringReader);
XMLSerializedView.Fill(this.pivotGrid);
The problem is that the levels are not getting expanded when the load method run. I think the problem is about to SavedPivotGridView class. But I could not find. Any suggestion?
Hi tbabur!
We are currently preparing a new sample where an improved approach is used in saving/loading pivot grid views. It will be published with the next service release, which is planned to ship in about two weeks. I will write to you here as soon the sample is published.
If it is not acceptable for you to wait until then, could you provide some more details on the issue you are experiencing (e.g. what datasource you are using etc.) or maybe attach a sample where it could be reproduced?
Regards,
Philip
I can wait about two weeks. But I do not know I do something wrong or it is related to a new version?
So here is my code that almost same the above link. I call the SavedPivotGridView class methods from these methods.
public void SaveQuery() { XMLSerializedView = new SavedPivotGridView(); XMLSerializedView.SaveView(pivotGrid);
XmlSerializer serializer = new XmlSerializer(typeof(SavedPivotGridView)); MemoryStream memoryStream = new MemoryStream(); serializer.Serialize(memoryStream, XMLSerializedView);
SaveFileDialog saveFileDialog = new SaveFileDialog() { DefaultExt = "xml", Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*", FilterIndex = 1 };
if (saveFileDialog.ShowDialog() == true) { using (Stream stream = saveFileDialog.OpenFile()) { byte[] bytes = memoryStream.ToArray(); stream.Write(bytes, 0, bytes.Length); stream.Close(); memoryStream.Close(); } } }
public void LoadQuery() {
XmlSerializer serializer = new XmlSerializer(typeof(SavedPivotGridView));
OpenFileDialog openFileDialog = new OpenFileDialog() { Multiselect = false, Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*", FilterIndex = 1 };
bool? result = openFileDialog.ShowDialog();
if (result != null && result == true) { XMLSerializedView = (SavedPivotGridView)serializer.Deserialize(openFileDialog.File.OpenRead()); XMLSerializedView.Fill(pivotGrid); } }