iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more
When a WPF validation error is not visible, first check whether the binding recorded an error and then check how the control presents it. An error can exist in Validation.Errors even when the user cannot read its message. For property validation, IDataErrorInfo is a straightforward synchronous option; INotifyDataErrorInfo offers a notification-based contract with more flexibility. Neither interface, by itself, guarantees that an explanation appears as readable text.
Why WPF validation errors may not appear as messages
Validation and presentation are separate parts of the WPF binding experience. A binding rule can detect invalid data and set Validation.HasError on the bound element, while the control’s template determines what the person using the app actually sees. Microsoft documents that the default ErrorTemplate draws a red border in the adorner layer; that visual cue does not necessarily show the error explanation as text. Microsoft’s WPF data-binding overview covers the validation state and default template. An archived Microsoft article also notes that the associated error message is not displayed by default: Input Validation: Enforcing Complex Business Data Rules with WPF.
That distinction gives you a useful first question: is there no validation error, or is there an error that the current UI does not explain?
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Diagnose the binding before changing the error display
- Confirm the binding source and path. Check the control’s effective
DataContext, or its explicitSource, and make sure it is the object implementing the validation interface. Confirm the bindingPathnames the property you expect. A correct validation implementation will not help if the binding points somewhere else. - Check the interface-specific binding option. For
IDataErrorInfo, setValidatesOnDataErrors="True"or add aDataErrorValidationRule. ForINotifyDataErrorInfo, check thatValidatesOnNotifyDataErrorshas not been disabled; its documented default istrue. See Microsoft’s API documentation forValidatesOnDataErrorsandValidatesOnNotifyDataErrors. - Verify that the source returns or raises an error. With
IDataErrorInfo, the indexer must return a nonempty message for the bound property name. WithINotifyDataErrorInfo, verify that the implementation exposes the expected errors and sends the required notifications when they change. Microsoft’s WPF guide walks through implementing validation on custom objects: How to: Implement Validation Logic on Custom Objects. - Inspect the control’s validation state. Examine
Validation.HasErrorandValidation.Errorson the bound element. IfHasErroris true andErrorscontains an entry, the binding has recorded a validation error; focus on how the UI displays it. A subsequent valid transfer can clear the error state. - Inspect the control’s presentation. Look for a custom
ErrorTemplate, styles that replace the default template, and a tooltip or other message element. A red border without explanatory text usually means the visual error cue is present but the message has no readable presentation. - Check event notification and update timing if the error seems absent or late. The attached
Validation.Errorevent is raised only for bindings withNotifyOnValidationError="True". Validation also depends on when the target value transfers to the source; checkUpdateSourceTriggerif the rule appears to run only after a delay. WPF’s overview describes validation and source-update behavior: Data binding overview – WPF.
Show the error message in the control
A tooltip is one compact way to expose the first recorded error while retaining the normal validation border. The following illustrative pattern binds a TextBox to a property named Name, enables IDataErrorInfo validation, and shows the first error’s ErrorContent when the control has an error:
#1 Best Overall
<TextBox>
<TextBox.Style>
<Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="True">
<Setter Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}" />
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
<TextBox.Text>
<Binding Path="Name"
ValidatesOnDataErrors="True"
UpdateSourceTrigger="PropertyChanged" />
</TextBox.Text>
</TextBox>
This follows the pattern in Microsoft’s validation-property example; adapt the property, control, and presentation to your view. A tooltip is not the only option: a custom ErrorTemplate or a separate message element can make errors easier to discover, especially where users may not hover over the control.
Choose between IDataErrorInfo and INotifyDataErrorInfo
Choose based on how the source manages validation and how much flexibility the application needs. Both interfaces still rely on WPF binding validation and a deliberate UI treatment for the error message.
| Decision point | IDataErrorInfo |
INotifyDataErrorInfo |
|---|---|---|
| How WPF uses it | Enable ValidatesOnDataErrors or use a DataErrorValidationRule. The property indexer supplies the bound property’s error; the binding engine does not use the interface’s Error property for ordinary bound-property validation. Microsoft API reference; interface guidance. |
WPF checks for and reports errors from a source implementing the interface when ValidatesOnNotifyDataErrors is enabled. Its documented default is true. Microsoft API reference. |
| Best fit | A simpler synchronous property-validation pattern when returning an error for a property is enough. | A notification-based validation model when the application needs the added flexibility. Microsoft’s interface guidance identifies future asynchronous validation as a limitation of IDataErrorInfo; confirm behavior for the target framework and libraries. |
| Does it display explanatory text by itself? | No. The validation state still needs an appropriate control presentation. | No. The validation state still needs an appropriate control presentation. |
| Compatibility check | Microsoft’s API reference lists the binding option across .NET Framework and Windows Desktop versions; check the target runtime and controls for the application. | The API reference lists .NET Framework 4.5 onward and Windows Desktop 3.0 onward; check the target runtime and controls for the application. |
Microsoft’s IDataErrorInfo guidance recommends that new entity classes generally prefer INotifyDataErrorInfo for its added flexibility. Treat that as guidance, not a universal rule: assess the target framework, validation workflow, and existing code before changing interfaces.
Recommended Free Tools
When the cause is still unclear
The exact cause in a specific application cannot be determined without its binding XAML, source object, target framework, control template, and runtime state. Use the checks above to separate a source or binding problem from a presentation problem; once Validation.HasError and Validation.Errors show what WPF recorded, investigate the relevant layer rather than switching interfaces at random.
Quick Recap
Best Value
- Used Book in Good Condition
Rank #4
Rank #3
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

