Back to Devexpress

TreeViewControl.NodeContentTemplate Property

wpf-devexpress-dot-xpf-dot-grid-dot-treeviewcontrol-655eff9e.md

latest4.3 KB
Original Source

TreeViewControl.NodeContentTemplate Property

Gets or sets a template that defines the node content appearance. 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 DataTemplate NodeContentTemplate { get; set; }
vb
Public Property NodeContentTemplate As DataTemplate

Property Value

TypeDescription
DataTemplate

The template used to display the node content. The template’s data context is an EditGridCellData object.

|

Remarks

Specify the NodeContentTemplate property if you want to use the same template to display and edit data.

You can use separate in-place editors to display and edit data. The TreeViewControl includes templates that allow you to define editors that display (when the control is in browse mode) and edit (when the control is in edit mode) node values:

TemplateDescription
NodeContentDisplayTemplateThe template that displays node values.
NodeContentEditTemplateThe template that displays an editor used to edit node values.

Use the NodeTemplate property if you want to change the appearance of an entire node.

Example

The following code sample displays wrapped text in the TreeViewControl‘s nodes and in their editors:

xaml
<dxg:TreeViewControl ...
                     AllowEditing="True">
    <dxg:TreeViewControl.NodeContentTemplate>
        <DataTemplate>
            <dxe:TextEdit x:Name="PART_Editor" TextWrapping="Wrap" MaxWidth="100"/>
        </DataTemplate>
    </dxg:TreeViewControl.NodeContentTemplate>
</dxg:TreeViewControl>

If you have more than one node content template, use the NodeContentTemplateSelector property to implement custom logic to choose the required template.

Tip

See Also

NodeContentDisplayTemplate

NodeContentEditTemplate

NodeTemplate

TreeViewControl Class

TreeViewControl Members

DevExpress.Xpf.Grid Namespace