Customizing the Appearances of Columns

  • 2 minutes to read

This topic describes how to customize the appearances of individual columns.

Customizing the Appearances of Columns

By default, the data cells within the Tree List are painted using the appearance settings provided by a Tree List (see the TreeList.Appearance property). This allows a common appearance for all the data cells, and for the cells displayed within the focused and selected nodes to be specified. Each column has a TreeListColumn.AppearanceCell property that allows you to override the default appearance settings for this particular column.

By default, a column's appearance settings only take priority over the Tree List's appearances which are used to paint the cells within the regular and selected nodes. However, they are overridden by the Tree List's appearances which are used to paint the focused node and focused cell. To give the column's appearance settings a higher priority, so that they override the control's appearances for the focused node and focused cell, set the AppearanceOptionsEx.HighPriority option of the TreeListColumn.AppearanceCell object to true.

Example

The following code specifies the appearance settings used to paint the Budget column's cells. The column's appearance is accessed via the TreeListColumn.AppearanceCell property.

The image below shows the result.

Styles - ColumnStyle2

treeList1.Columns["Budget"].AppearanceCell.ForeColor = Color.DarkOrange;
treeList1.Columns["Budget"].AppearanceCell.BackColor = Color.PeachPuff;
treeList1.Columns["Budget"].AppearanceCell.Font = new Font("Verdana", 8, FontStyle.Bold);