Skip to main content

TreeListColumn.FieldName Property

Gets or sets the field name assigned to the current column from a datasource.

Namespace: DevExpress.XtraTreeList.Columns

Assembly: DevExpress.XtraTreeList.v23.1.dll

NuGet Package: DevExpress.Win.TreeList

Declaration

[DefaultValue("")]
[XtraSerializableProperty]
public string FieldName { get; set; }

Property Value

Type Default Description
String String.Empty

A String value that specifies the name of a data field.

Remarks

Use this property to change the field name assigned to the current column from the datasource. If this property is changed at runtime, the column caption is not modified, but the column contents change. In order to update the column caption, set the TreeListColumn.Caption property to the appropriate value.

The FieldName property value can be used as a column identifier, as for example, in the TreeListNode.Item property, TreeListNode.GetValue and other methods.

There must be a case match between strings assigned to the FieldName properties, and the names of the columns in the underlying data source.

Example

The following example demonstrates how to add and adjust a new column bound to the “Checked” field. The column is bound to the field using the TreeListColumn.FieldName property. The sample code changes the caption of the column and its visible index via the TreeListColumn.Caption and TreeListColumn.VisibleIndex properties.

TreeListColumn column = treeList1.Columns.Add();
column.FieldName = "Checked";   
column.Caption = "Check-It";
column.VisibleIndex = treeList1.Columns.Count - 1;
See Also