Assigning Styles To Individual Rows
- 2 minutes to read
The styles technology introduced by the ExpressVerticalGrid enables you to assign common styles to elements of a particular type. However, there may be situations when you want to provide different styles to elements of the same type. This topic describes how to assign styles to individual rows. For more information on assigning styles to individual elements of the same type, please refer to the Using Styles Events and Custom Painting Overview topics.
Vertical grid rows publish the Row.Styles property. This property allows styles to be assigned to the row header and row contents.
The following example assigns styles to the category and editor rows. The initial appearance of the vertical grid control is shown in the image below:
Follow the steps below.
- Drop a TcxStyleRepository component on a form. Double-click it to invoke the Styles editor. Create a style, name it CategoryStyle and modify its settings.
- Create another style, name it EditorRowStyle and set it up as required.
- Double-click the vertical grid control to invoke the Rows editor. Select the category row and assign CategoryStyle to the Row.Styles.Header property of the category row.
- Select the editor row and assign EditorRowStyle to the Row.Styles.Content property of the editor row.
- Run the application to see the result.
Note
assigning styles to individual rows overrides the VerticalGrid.Styles property settings. Other ways to override the VerticalGrid.Styles settings are by using the styles events and the custom painting mechanism.