We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Problems using ReadXML for grid styles

Thread ID:





16993 Jul 28,2004 05:26 PM UTC Jul 29,2004 11:45 AM UTC WinForms 4
Tags: GridControl
Adam Hill
Asked On July 28, 2004 05:26 PM UTC

I''m trying to use WriteXML() and ReadXML() to copy properties into members of the BaseStylesMap collection of a grid. WriteXML() seems to work fine, and ReadXML() works for some properties, but if there are any properties which use nested tags (e.g. true), there are problems. After reading XML containing any nested properties, the grid either starts replacing headers with red boxes that say "Exception," or just throwing exceptions at various times. Any properties that appear in the XML before a nested property are applied (not that it matters much with the grid broken), but those that appear afterward are not.

Administrator [Syncfusion]
Replied On July 28, 2004 07:23 PM UTC

We are not aware of any problems of this nature. There was an problem reading and writing XML schema in the version of our GridGroupingControl, but that was fixed in, and did not relate to GridStyleInfo properties. When you mention Tag I assume you mean an XML tag and not a GridStyleInfo.Tag object. If you are using a custom style.Tag object, then your object would have to implement ISerializable in order for the grid to be able to serialize it as part of a GridStyleInfo. Can you provide a sample project showing the problem you are having?

Adam Hill
Replied On July 29, 2004 09:25 AM UTC

Here is a sample project. StyleDemo_8543.zip

Administrator [Syncfusion]
Replied On July 29, 2004 10:26 AM UTC

Thank you for the sample. I was able to avoid the problem you are seeing in the sample with this code. System.IO.StringReader tr = new System.IO.StringReader(txtXML.Text); System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(tr); GridStyleInfo style = new GridStyleInfo(); style.ReadXml(reader); reader.Close(); gridControl1.BaseStylesMap["Standard"].StyleInfo.ModifyStyle(style, Syncfusion.Styles.StyleModifyType.Override); The GridStyleInfo.ReadXml only sets the properties respresented in the XML, leaving all the other properties of the new style object unset. I think here is an explanation of this problem. In the standard basestyle, this is not acceptable as all properties need to be set here (even if they are only the default settings). Having unset properties in most style objects does not matter since they fall back on some parent style for any unset values. But the standard style is the ultimate parent and hence must be fully populated. The code above avoids this problem by getting the XML set properties into a new style object, and then just overriding the properties in the standard style which were set in the XML. I will discuss this problem with Stefan, the grid architect, to see if he thinks my explanation is correct, and if there is something we can do, or if the standard style will have to be handled as a special case in the manner of the code above.

Administrator [Syncfusion]
Replied On July 29, 2004 11:45 AM UTC

The GridStyleInfo.WriteXml/ReadXml were intended as implementation methods for IXmlSerializable. They were not intended for stand-alone use of directly reading and writing Xml. That is why you had to add the tags to avoid the parsing error. And, it is also why the serialization of the standard style is behaving the way it is.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon