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

GridStyleInfo serialisation

Thread ID:





5217 Jun 25,2003 11:45 AM UTC Jun 25,2003 12:16 PM UTC WinForms 1
Tags: GridControl
Olivier Choquette
Asked On June 25, 2003 11:45 AM UTC

I want to save custom visual properties of my grid which are stored in a series of GridStyleInfo objects (styles for the currently selected row, selected cell and alternating "blocks" of rows for example). Is there an (easy) way to save all those properties (background color, font, text color, etc.) in XML. Maybe i'm doing it wrong. I'm using GridStyleInfo object because it seemed like a good idea at the time ;) thx Olivier

Administrator [Syncfusion]
Replied On June 25, 2003 12:16 PM UTC

Did you derive from the GridStyleInfoCustomProperties class? If yes, then you can take advantage of built-in Xml serialization features for style objects in the 1.6 version. If you have a GridData object, you can serialize this one as follows: Stream s = File.OpenWrite("C:/ttt.xml"); XmlWriter xw = new XmlTextWriter(s, System.Text.Encoding.Default); XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(model.Data.GetType()); xs.Serialize(xw, model.Data); s.Close(); To load a data object: Stream s = File.OpenRead("C:/ttt.xml"); XmlReader xw = new XmlTextReader(s); XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(model.Data.GetType()); model.Data = (GridData) xs.Deserialize(xw); s.Close(); You can also serialize an individual style object of course that same way (just replace the type when creating the XmlSerializer). Stefan


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