windowsforms-devexpress-dot-xtratreelist-dot-columns-dot-treelistcolumn-244287cb.md
Gets or sets the field name assigned to the current column from a datasource.
Namespace : DevExpress.XtraTreeList.Columns
Assembly : DevExpress.XtraTreeList.v25.2.dll
NuGet Packages : DevExpress.Win.Navigation, DevExpress.Win.TreeList
[DefaultValue("")]
[XtraSerializableProperty]
public string FieldName { get; set; }
<DefaultValue("")>
<XtraSerializableProperty>
Public Property FieldName As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A String value that specifies the name of a data field.
|
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.
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;
TreeListColumn Column = TreeList1.Columns.Add()
Column.FieldName = "Checked"
Column.Caption = "Check-It"
Column.VisibleIndex = TreeList1.Columns.Count - 1
The following code snippets (auto-collected from DevExpress Examples) contain references to the FieldName property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
var row = tree.GetDataRecordByNode(e.Node) as DashboardFlatDataSourceRow;
e.DisplayText = flatData.GetDisplayText(e.Column.FieldName, row);
}
winforms-treelist-create-file-manager-drag-drop-files-folders/CS/FileList/FileListHelper.cs#L47
this.treeListColumn1.Caption = "FullName";
this.treeListColumn1.FieldName = "FullName";
if (node == null) return;
this.OnCustomizeAppearance(new CustomizeAppearanceEventArgs(tl.FocusedColumn.FieldName, "ViewItem", new GridViewCancelEventArgsAppearanceAdapter(null, e), node.Object, null));
}
winforms-treelist-unbound-columns/CS/TreeList_UnboundDataViaEvent/Form1.cs#L30
unbColumnMarchChange.OptionsColumn.AllowEdit = false;
unbColumnMarchChange.FieldName = "ChangeFromPrevYear";
unbColumnMarchChange.Caption = "Change from Previous Year";
xaf-win-gantt-control/CS/XPO/GanttSolutionXPO/GanttSolutionXPO.Win/Editors/CustomGanttEditor.cs#L69
ganttColumn.Caption = column.Caption;
ganttColumn.FieldName = column.PropertyName;
ganttColumn.Name = column.PropertyName + "Column";
winforms-treelist-create-file-manager-drag-drop-files-folders/VB/FileList/FileListHelper.vb#L46
treeListColumn1.Caption = "FullName"
treeListColumn1.FieldName = "FullName"
treeListColumn2.Caption = "Name"
Dim row = TryCast(tree.GetDataRecordByNode(e.Node), DashboardFlatDataSourceRow)
e.DisplayText = flatData.GetDisplayText(e.Column.FieldName, row)
End Sub
winforms-treelist-unbound-columns/VB/TreeList_UnboundDataViaEvent/Form1.vb#L25
unbColumnMarchChange.OptionsColumn.AllowEdit = False
unbColumnMarchChange.FieldName = "ChangeFromPrevYear"
unbColumnMarchChange.Caption = "Change from Previous Year"
winforms-treelist-expression-editor-xpview/VB/E1887/Form1.vb#L56
If column Is Nothing Then Return String.Empty
Return If(String.IsNullOrEmpty(column.Caption), column.FieldName, column.Caption)
End Get
winforms-treelist-virtual-mode/VB/ExampleMainForm.vb#L20
Dim newColumnDescription As TreeListColumn = MyTtreeList.Columns.Add()
newColumnDescription.FieldName = "Description"
newColumnDescription.VisibleIndex = 0
See Also