Back to Devexpress

TreeListView.ParentFieldName Property

wpf-devexpress-dot-xpf-dot-grid-dot-treelistview-dee0b6f3.md

latest4.7 KB
Original Source

TreeListView.ParentFieldName Property

Gets or sets the name of the service field in a data source that identifies the parent node. This is a dependency property.

Namespace : DevExpress.Xpf.Grid

Assembly : DevExpress.Xpf.Grid.v25.2.dll

NuGet Package : DevExpress.Wpf.Grid.Core

Declaration

csharp
public string ParentFieldName { get; set; }
vb
Public Property ParentFieldName As String

Property Value

TypeDescription
String

The name of the field that identifies the parent node.

|

Remarks

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).

Limitations

  • The Key and Parent fields should have the same data type.
  • A node cannot have equal Key and Parent field values.
  • Do not use Unbound columns as service columns.

The following code snippets (auto-collected from DevExpress Examples) contain references to the ParentFieldName 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

xml
<dxg:TreeListView AutoExpandAllNodes="True" AutoWidth="True"
                  KeyFieldName="ID" ParentFieldName="ParentID"
                  ShowNodeFooters="True"

wpf-lookupedit-display-treelist-as-popup-content/CS/CustomTreeViewComboBox/MainWindow.xaml#L20

xml
KeyFieldName="ID"
ParentFieldName="ParentID"
TreeDerivationMode="Selfreference"/>

how-to-customize-drop-marker-t568780/CS/MainWindow.xaml#L23

xml
<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#L15

xml
<dxg:TreeListView KeyFieldName="ID"
                  ParentFieldName="ParentID"
                  AutoExpandAllNodes="True"

wpf-treelist-iterate-through-nodes-with-the-treelistnodeiterator/CS/WpfApplication1/MainWindow.xaml#L13

xml
<dxg:TreeListView x:Name="view" AutoWidth="True"
                      KeyFieldName="ID" ParentFieldName="ParentID"/>
</dxg:GridControl.View>

See Also

KeyFieldName

RootValue

TreeListView Class

TreeListView Members

DevExpress.Xpf.Grid Namespace