Skip to main content

DataViewBase.HasErrors Property

Gets whether the view has any data editing errors. This is a dependency property.

Namespace: DevExpress.Xpf.Grid

Assembly: DevExpress.Xpf.Grid.v22.2.Core.dll

NuGet Package: DevExpress.Wpf.Grid.Core


public bool HasErrors { get; }

Property Value

Type Description

true, if the view has any data editing errors; otherwise, false.


Use the HasErrors property to check whether the view has any data editing errors. The HasErrors property works only if the DataViewBase.ErrorsWatchMode property is set to All, Cell, or Row.

The HasErrors property is updated when you post changes to a data source. Use the DataViewBase.HasValidationError property to check whether the view has any validation errors that prohibit you from posting changes to a data source.


When the DataViewBase.ErrorsWatchMode property is set to All, Cell, or Row, the GridControl revalidates its data during the initial loading that can significantly decrease the control’s performance.


To pass validation data from the GridControl to a view model, use the ReadOnlyDependencyPropertyBindingBehavior to bind the view’s HasErrors property to a view model property. Set the view’s ErrorsWatchMode property to Cells.

View Example

<dx:ThemedWindow x:Class="DXSample.MainWindow"
                 Title="{DXBinding '`GridControl has errors: ` + HasErrors'}">

        <local:MainViewModel />

        <dxg:GridControl AutoGenerateColumns="AddNew"
                         ItemsSource="{Binding TaskList}">
                <dxg:TableView ErrorsWatchMode="Cells"
                               InvalidRowExceptionCommand="{Binding InvalidRowCommand}"
                               ValidateRowCommand="{Binding ValidateRowCommand}">
                        <dxmvvm:ReadOnlyDependencyPropertyBindingBehavior Property="HasErrors"
                                                                          Binding="{Binding HasErrors, UpdateSourceTrigger=PropertyChanged}" />

public class MainViewModel : ViewModelBase {
    public bool HasErrors {
        get { return GetValue<bool>(); }
        set { SetValue(value); }
    public ObservableCollection<Task> TaskList { get; }
    public MainViewModel() {
        TaskList = new ObservableCollection<Task> {
            new Task() {
                TaskName = "Complete Project A",
                StartDate = new DateTime(2009, 7, 17),
                EndDate = new DateTime(2009, 7, 10)
            new Task() {
                TaskName = "Test Website",
                StartDate = new DateTime(2009, 7, 10),
                EndDate = new DateTime(2009, 7, 12)
            new Task() {
                TaskName = string.Empty,
                StartDate = new DateTime(2009, 7, 4),
                EndDate = new DateTime(2009, 7, 6)

    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");
        if (string.IsNullOrEmpty(task.TaskName))
            return new ValidationErrorInfo("Enter a task name");
        return null;

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