Back to Devexpress

ValidationArgs.Result Property

corelibraries-devexpress-dot-mvvm-dot-xpf-dot-validationargs.md

latest4.9 KB
Original Source

ValidationArgs.Result Property

Gets or sets an error description if row data are invalid. Null if data are valid.

Namespace : DevExpress.Mvvm.Xpf

Assembly : DevExpress.Mvvm.v25.2.dll

NuGet Packages : DevExpress.Mvvm, DevExpress.Win.Navigation

Declaration

csharp
public ValidationErrorInfo Result { get; set; }
vb
Public Property Result As ValidationErrorInfo

Property Value

TypeDescription
ValidationErrorInfo

An error description.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the Result 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-extend-crud-operations/CS/Undo/UndoCRUDOperationsBehavior.cs#L112

csharp
AssociatedObject.ValidateRowCommand?.Execute(args);
if(!Validate(args.Result)) {
    return;

wpf-data-grid-initialize-new-item-row-with-default-values/CS/NewItemRow_MVVM/MainViewModel.cs#L45

csharp
if(args.IsNewItem && string.IsNullOrEmpty(((Product)args.Item).ProductName)) {
    args.Result = new ValidationErrorInfo("Please enter the Product Name.");
}

wpf-data-grid-validate-cell-editors/CS/ValidateCell_MVVM/MainViewModel.cs#L43

csharp
: $"The discount cannot be greater than 30% ({cellValue * 0.7}). Please correct the price.";
    args.Result = new ValidationErrorInfo(error, ValidationErrorType.Critical);
}

wpf-data-grid-validate-data-rows/CS/ValidateRow_MVVM/MainViewModel.cs#L60

csharp
public void ValidateRow(RowValidationArgs args) {
    args.Result = GetValidationErrorInfo((Task)args.Item);
}

wpf-data-grid-extend-crud-operations/VB/Undo/UndoCRUDOperationsBehavior.vb#L141

vb
AssociatedObject.ValidateRowCommand?.Execute(args)
If Not Validate(args.Result) Then
    Return

wpf-data-grid-initialize-new-item-row-with-default-values/VB/NewItemRow_MVVM/MainViewModel.vb#L52

vb
If args.IsNewItem AndAlso String.IsNullOrEmpty(CType(args.Item, Product).ProductName) Then
    args.Result = New ValidationErrorInfo("Please enter the Product Name.")
End If

wpf-data-grid-validate-cell-editors/VB/ValidateCell_MVVM/MainViewModel.vb#L46

vb
Dim [error] = If(discount < 0, $"The price cannot be greater than {cellValue}", $"The discount cannot be greater than 30% ({cellValue * 0.7}). Please correct the price.")
    args.Result = New ValidationErrorInfo([error], ValidationErrorType.Critical)
End Sub

wpf-data-grid-validate-data-rows/VB/ValidateRow_MVVM/MainViewModel.vb#L52

vb
Public Sub ValidateRow(ByVal args As RowValidationArgs)
    args.Result = GetValidationErrorInfo(CType(args.Item, Task))
End Sub

See Also

ValidationArgs Class

ValidationArgs Members

DevExpress.Mvvm.Xpf Namespace