Style Schemes

  • 2 minutes to read

The vertical grid controls (VGridControl and PropertyGridControl) give you the ability to simultaneously change the styles of all their elements. This can be done by applying a style scheme to a control. A style scheme is a set of appearance settings for all the vertical grid's elements. There are two types of style schemes: predefined style schemes (style formats) and manually created style schemes (style layouts). This topic describes how to use both types. It's assumed that you are familiar with the Appearance mechanism introduced in the Appearances topic.

Using Style Formats

The vertical grid controls provide multiple style schemes which you can easily apply at design time via the Style Schemes Page of the VerticalGrid Designer.

VGrid-Style Formats-Vagabond2

When a style scheme is applied to the control the appearance settings specified by the VGridControlBase.Appearance object are modified according to the selected scheme. The following image show the appearance settings used to paint category rows after the Vagabond paint scheme has been applied:

CD_StyleSchemes_AppPropertesChanged

To apply predefined style schemes at runtime the following code can be used:


DevExpress.XtraVerticalGrid.Design.XAppearances schemes = new DevExpress.XtraVerticalGrid.Design.XAppearances("");
schemes.LoadScheme("Vagabond", vGridControl1);

Using Style Layouts

The vertical grids also allow you to manually create style schemes. This can be done by adjusting the desired appearance settings on the Appearance Page page of the VerticalGrid Designer and saving the appearances to an XML file using the Save Appearance Layout... button. Use the Load Appearance Layout... button to restore saved appearance settings:

You can also save and restore the appearance settings at runtime. This can be done using the BaseAppearanceCollection.SaveLayoutToXml and BaseAppearanceCollection.RestoreLayoutFromXml methods of the VGridControlBase.Appearance object.