wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-7ad34e21.md
Gets or sets the name of the service field in a data source that contains unique values. This is a dependency property.
Namespace : DevExpress.Xpf.Grid
Assembly : DevExpress.Xpf.Grid.v25.2.dll
NuGet Package : DevExpress.Wpf.Grid.Core
public string KeyFieldName { get; set; }
Public Property KeyFieldName As String
| Type | Description |
|---|---|
| String |
The name of the field that contains unique values.
|
If you want to implement the Self-Referential data structure, you should include two service fields in your data source:
Key FieldContains unique values. Assign this field to the KeyFieldName property.Parent FieldIdentifies the parent node. Assign this field to the ParentFieldName property.
Columns bound to these fields are called service columns.
Both KeyFieldName and ParentFieldName properties support nested fields (for example, Account.Id).
The following code snippets (auto-collected from DevExpress Examples) contain references to the KeyFieldName 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.
wpf-tree-list-calculate-custom-node-summaries/CS/CustomNodeSummaries_CodeBehind/MainWindow.xaml#L14
<dxg:TreeListView AutoExpandAllNodes="True" AutoWidth="True"
KeyFieldName="ID" ParentFieldName="ParentID"
ShowNodeFooters="True"
wpf-lookupedit-display-treelist-as-popup-content/CS/CustomTreeViewComboBox/MainWindow.xaml#L19
AutoExpandAllNodes="True"
KeyFieldName="ID"
ParentFieldName="ParentID"
how-to-customize-drop-marker-t568780/CS/MainWindow.xaml#L23
<dxg:GridControl.View>
<dxg:TreeListView KeyFieldName="ID" ParentFieldName="ParentID"
AutoExpandAllNodes="True" AllowDragDrop="True">
how-to-implement-drag-and-drop-between-gridcontrols-t566656/CS/MainWindow.xaml#L14
<dxg:GridControl.View>
<dxg:TreeListView KeyFieldName="ID"
ParentFieldName="ParentID"
<dxg:TreeListView x:Name="view" AutoWidth="True"
KeyFieldName="ID" ParentFieldName="ParentID"/>
</dxg:GridControl.View>
See Also