Articles in this section
Category / Section

How can I change the Appearance of the Grid during run time?

1 min read

 

1. In the Designer, after making the appropriate changes to the Appearance settings of the Grid click on the Save Look and Feel Verb which gives you an option to save the settings to an XMLfile.

2. In the Solution Explorer for the project, right click on the project name and choose Add->Add Existing Item and choose look and feel XML file. Ensure that the Build Action property for this file is set to Embedded Resource.

The following code snippet shows how this can now be used to change the look and feel of the GridControl during run time (from orangeblue.xml file)

C#

// Apply Look and Feel saved in orangeblue.xml

System.IO.Stream strm = typeof(Skins.WebForm1).Assembly.GetManifestResourceStream("Skins.orangeblue.xml");

System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(strm);

GridGroupingLookAndFeel laf = GridGroupingLookAndFeel.CreateFromXml(reader);

laf.ApplyTo(this.GridGroupingControl);

reader.Close();

strm.Close();

VB

'Apply Look and Feel saved in orangeblue.xml

Dim strm As System.IO.Stream = GetType(Skins.WebForm1).Assembly.GetManifestResourceStream("orangeblue.xml")

Dim reader As System.Xml.XmlTextReader = New System.Xml.XmlTextReader(strm)

Dim laf As GridGroupingLookAndFeel = GridGroupingLookAndFeel.CreateFromXml(reader)

laf.ApplyTo(Me.GridGroupingControl)

reader.Close()

strm.Close()

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied