All docs
V21.2
21.2
21.1
The page you are viewing does not exist in version 21.1. This link will take you to the root page.
20.2
The page you are viewing does not exist in version 20.2. This link will take you to the root page.
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

ValidationService Class

The service that allows you to implement validation in compliance with MVVM.

Namespace: DevExpress.Xpf.Editors

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

Declaration

public class ValidationService :
    DependencyObject

The following members accept/return ValidationService objects:

Remarks

The ValidationService only supports standalone editors. To use the ValidationService with a GridControl, set the IsValidationContainer property to true for the GridControl.

To define validation rules at the View level, enable the IsValidationContainer option at the root container level and bind to the HasValidationError property:

<Grid dxe:ValidationService.IsValidationContainer="True">
  ...
  <Button ... IsEnabled="{Binding Path=(dxe:ValidationService.HasValidationError), RelativeSource={RelativeSource Self}, Converter={dxc:NegationConverter}}" />
</Grid>

To handle validation at the ViewModel level, create a custom attached property or attached behavior that binds to the HasValidationError property and passes its value to the view model level.

The Lesson 4 - Implement Input Validation using ValidationRules topic illustrates how to use the ValidationService.

Inheritance

See Also