Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

ValidationService Class

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

Namespace: DevExpress.Xpf.Editors

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

NuGet Package: DevExpress.Wpf.Core

#Declaration

public class ValidationService :
    DependencyObject

The following members return ValidationService objects:

#Remarks

The ValidationService only supports standalone editors.

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.

Note

ValidationService only works with editors available in the Visual Tree. The GridControl does not support ValidationService due to the following factors:

  • GridControl creates visual elements only for visible rows and columns.
  • Inactive cells do not contain editors in optimized mode.

#Inheritance

See Also