Customizing the Appearance of TreeList Elements

  • 2 minutes to read

Customizing the Appearance of TreeList Elements

All DevExpress .NET Windows Forms controls use the Appearances mechanism to customize their look and feel. The controls provide properties that allow you to customize the appearance of various control elements in a centralized way. In addition, there are properties that allow you to customize the appearance of individual control elements, overriding the default appearance.

The Tree List holds a collection of appearances that are used to paint its elements (cells, column headers, summary, etc.). This collection can be accessed via the TreeList.Appearance property:

TreeList_Appearance_property

These appearances can also be accessed and customized at design time using the Appearances page of the Tree List Designer. This page is shown in the image below.

Designer - Appearances

The appearance settings provided by the TreeList.Appearance property define default styles for columns and rows. To override these default styles for individual columns, use the appearance settings provided by TreeListColumn objects. See Customizing the Appearances of Columns.

To override the default appearance for individual cells, use specific events. See Customizing the Appearance of Individual Cells to learn more.

Example

The following example changes the appearance of odd rows. The corresponding appearance property is accessed via the TreeList.Appearance property.

The image below shows the result.

Styles - OddRows

treeList1.Appearance.OddRow.BackColor = Color.LightSteelBlue;
treeList1.OptionsView.EnableAppearanceOddRow = true;