Skip to main content
All docs

GridViewBase.ValidateRowCommand Property

Gets or sets a command that validates row values.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v23.1.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public ICommand<RowValidationArgs> ValidateRowCommand { get; set; }

Property Value

Type Description

A command that validates row values.


Bind a command to the ValidateRowCommand property to maintain a clean MVVM pattern. The command works like a ValidateRow event handler and allows you to process the row validate operation in a View Model.

The GridControl executes a command bound to the ValidateRowCommand property when the control saves changes to a data source. The save changes process starts when a user focuses another row, or you call the DataViewBase.CommitEditing method.

The Item property returns a data item within the processed row.

The following example verifies if data meet the validation criteria. Use the Result property to specify the validation message.

DevExpress WPF | Grid Control - Validate Row Command

View Example: How to Validate Data Rows

<dxg:GridControl ItemsSource="{Binding TaskList}" AutoGenerateColumns="AddNew">
        <dxg:TableView AutoWidth="True"
                       ValidateRowCommand="{Binding ValidateRowCommand}"
                       InvalidRowExceptionCommand="{Binding InvalidRowCommand}"/>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Mvvm.Xpf;
// ...
public class MainViewModel : ViewModelBase {
// ...
    public void ValidateRow(RowValidationArgs args) {
        args.Result = GetValidationErrorInfo((Task)args.Item);
    static ValidationErrorInfo GetValidationErrorInfo(Task task) {
        if(task.StartDate > task.EndDate)
            return new ValidationErrorInfo("Start Date must be less than End Date");
            return new ValidationErrorInfo("Enter a task name");
        return null;

    public void InvalidRow(InvalidRowExceptionArgs args) {
        args.ExceptionMode = ExceptionMode.NoAction;

Refer to the following topic for more information: Row Validation.

Use the ResultAsync property to validate row data asynchronously.

CRUD Operations

You can implement CRUD operations (create, read update, delete). These operations allow users to manage data in the Data Grid. Refer to the following topic for more information: Implement CRUD Operations in a Data-Bound Grid.

View Example: How to Implement CRUD Operations in a Data-Bound Grid

The following code snippets (auto-collected from DevExpress Examples) contain references to the ValidateRowCommand property.


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