Back to Devexpress

ValidationEventArgs.IsValid Property

wpf-devexpress-dot-xpf-dot-editors-dot-validationeventargs-809070ef.md

latest3.8 KB
Original Source

ValidationEventArgs.IsValid Property

Gets or sets a value specifying whether the value is valid.

Namespace : DevExpress.Xpf.Editors

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

NuGet Package : DevExpress.Wpf.Core

Declaration

csharp
public bool IsValid { get; set; }
vb
Public Property IsValid As Boolean

Property Value

TypeDescription
Boolean

true if the value is valid; otherwise, false.

|

Remarks

Use the IsValid property to specify whether a new value meets your validation criteria, and can be posted to the editor.

If the entered value is not valid, set the IsValid property to false. In this instance, this value will not be posted to the editor and an error icon defined by the ValidationEventArgs.ErrorType, will be displayed within the editor. The error description (error tooltip) can be specified using the ValidationEventArgs.ErrorContent property.

The following code snippets (auto-collected from DevExpress Examples) contain references to the IsValid 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-data-grid-initialize-new-item-row-with-default-values/CS/NewItemRow_CodeBehind/MainWindow.xaml.cs#L42

csharp
if(e.RowHandle == GridControl.NewItemRowHandle) {
    e.IsValid = !string.IsNullOrEmpty(((Product)e.Row).ProductName);
    e.Handled = true;

wpf-data-grid-validate-cell-editors/CS/ValidateCell_CodeBehind/MainWindow.xaml.cs#L36

csharp
e.IsValid = false;
e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical;

wpf-data-grid-initialize-new-item-row-with-default-values/VB/NewItemRow_CodeBehind/MainWindow.xaml.vb#L47

vb
If e.RowHandle = DataControlBase.NewItemRowHandle Then
    e.IsValid = Not String.IsNullOrEmpty(CType(e.Row, Product).ProductName)
    e.Handled = True

wpf-data-grid-validate-cell-editors/VB/ValidateCell_CodeBehind/MainWindow.xaml.vb#L41

vb
If discount > 0 AndAlso discount <= 30 Then Return
e.IsValid = False
e.ErrorType = DevExpress.XtraEditors.DXErrorProvider.ErrorType.Critical

See Also

ValidationEventArgs Class

ValidationEventArgs Members

DevExpress.Xpf.Editors Namespace