List provides various in-built styling options to help you style the control. The following sections discuss how you can use these options.
List provides six built-in visual styles so that you can easily customize the appearance of the control based on any of the Microsoft Office 2007 and 2010 themes. These visual styles can be accessed through VisualStyle property of the C1List class. Apart from MS Office based visual styles, you can also set the VisualStyle property to Custom or System. When set to Custom, List does not apply any visual styles and uses the list properties for rendering. When set to System, the list renders its appearance based on current system settings.
You can set the visual style using designer as well as through code. To set the visual style at design time, click smart tag icon () to open the C1List Tasks smart tag panel and select a visual style from the VisualStyle combobox.
To apply a visual style, say Office2007Black, to List through code, use the following code.
C# |
Copy Code
|
---|---|
c1List1.VisualStyle = C1.Win.C1List.VisualStyle.Office2007Black; |
List provides built-in collection of styles for predefined cell types and states such as selected cells, caption cells, inactive cells and, so on. You can use these built-in styles at design time as well as through code. In design view, you can access these styles through the Style Collection Editor. For more information, see Style Collection Editor.
Following code shows how to set background and foreground color using Styles collection of the List control.
C# |
Copy Code
|
---|---|
c1List1.Styles["Normal"].BackColor = Color.Lavender; c1List1.Styles["Selected"].BackColor = Color.MediumPurple; c1List1.Styles["Selected"].ForeColor = Color.Black; |