ComponentOne GridView for ASP.NET AJAX: Using GridView for ASP.NET AJAX > Visual Styles > Customizing the Control's Appearance

Customizing the Control's Appearance

If you choose to completely customize the appearance of the C1GridView control you may not wish to use any of the available built-in Visual Styles. In that case, to override any visual styles with your own custom appearance, you will need to set the UseEmbeddedVisualStyles property to False and create your own visual style using CSS.

To create your own visual style using CSS, you will need to do three things: add a custom style sheet to your project, set the UseEmbeddedVisualStyles property to False, and set the VisualStylePath and VisualStyle properties.

Step 1: Add a Custom Style Sheet

In order to create your own custom style, you must add a style sheet to your project. The VisualStylePath property determines the location of your visual style.

Step 2: Set theUseEmbeddedVisualStyles Property

The UseEmbeddedVisualStyles property allows you to override built-in visual styles with your own custom appearance. By default C1GridView.UseEmbeddedVisualStyles property is True and Visual Styles are used. Any customizations you make while using Visual Styles will simply set specific elements in the control's appearance on top of the current Visual Style. To start customizing the control's appearance from scratch set C1GridView.UseEmbeddedVisualStyles to False and set your own styles.

Step 3: Set the VisualStylePath and VisualStyle Properties

Once you have created a custom visual style and set the UseEmbeddedVisualStyles to False you must assign the C1GridView control's the VisualStylePath and VisualStyle properties to the visual style directory and the visual style name that you are using. For example, the VisualStylePath should be set to ~/VisualStyles and the VisualStyle property should be set to StyleName (assuming that StyleName is the name used to define the style in the styles.css file.


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.