Skip to main content

RepositoryItemTokenEdit.ValidateToken Event

Allows you to perform the custom validation on text currently entered in this TokenEdit control.

Namespace: DevExpress.XtraEditors.Repository

Assembly: DevExpress.XtraEditors.v23.2.dll

NuGet Package: DevExpress.Win.Navigation

Declaration

[DXCategory("Events")]
public event TokenEditValidateTokenEventHandler ValidateToken

Event Data

The ValidateToken event's data class is DevExpress.XtraEditors.TokenEditValidateTokenEventArgs.

Remarks

The ValidateToken event provides base TokenEdit functionality. This event, fired under multiple circumstances (e.g., when the Token Edit loses end-user focus), divides the text entered in the editor into multiple text blocks, according to the separator positions. Then, each block is validated using your custom logic, implemented within the ValidateToken event handler. A text block that passes this validation and gets its e.IsValid parameter set to true is converted into a token - an interactive UI element capable of displaying custom glyphs and an assigned to the RepositoryItemTokenEdit.PopupPanel property peek panel on hover.

In Manual mode (see the RepositoryItemTokenEdit.EditMode property), the ValidateToken event fires only when end-users manually type the text. In TokenList mode the ValidateToken event never fires at all.

Event arguments also provide the capability to read and modify token values and descriptions. To do so, use the e.Value and e.Description properties. Thus, by handling this event you can also manually process all tokens and modify them as required.

See the Token Edit Control topic for an example.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the ValidateToken event.

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.

See Also