All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

TreeViewControl.ValidateNode Event

Allows you to validate the focused node's data and specify whether to close the node's editor.

Namespace: DevExpress.Xpf.Grid

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

Declaration

public event TreeViewNodeValidationEventHandler ValidateNode
Public Event ValidateNode As TreeViewNodeValidationEventHandler

Event Data

The ValidateNode event's data class is DevExpress.Xpf.Grid.TreeList.TreeViewNodeValidationEventArgs.

Remarks

The TreeViewControl allows you to validate new node values. To enable this behavior, handle the ValidateNode event. This event occurs when a node is about to lose focus.

The Value property returns the focused node's new value. To indicate that the new value is invalid, set the IsValid property to false.

Set the AllowLeaveInvalidEditor property to true to allow users to close an editor that did not pass validation.

Example

<dxg:TreeViewControl x:Name="treeview"
                     AllowEditing="True"
                     ValidateNode="treeview_ValidateNode"
                     ... />
void treeview_ValidateNode(object sender, DevExpress.Xpf.Grid.TreeList.TreeViewNodeValidationEventArgs e) {
    e.IsValid = (e.Value != null) && (e.Value.ToString().Length >= 5);
    e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Warning;
    e.ErrorContent = "The name must contain at least 5 characters.";
}
See Also