Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1072141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:48:55+00:00 2026-05-16T20:48:55+00:00

This is a bit of a WPF whodunnit! My validation temples it not appearing

  • 0

This is a bit of a WPF whodunnit! My validation temples it not appearing when expected

The Problem

Basically, I am using IDataErrorInfo on my view model to provide feedback on data entry errors. I can see this being called and working as expected, but the validation error template for the bound control is never displayed by WPF!

I have tried both using the built-in default textbox red border error template, a style error template, and a hard coded template. None of these are displayed in a data error situation.

Heres my xaml binding code:

<TextBox x:Name="txtCaseNumber"  
Text="{Binding Path=CaseNumber, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}"/>

Wierdly, the error gets into the Validation.Errors collection. The follow code results in my IDataErrorInfo error message getting displayed next to the bound control. This leads me to think the problem is on the xaml side, rather the viewmodel side.

<ContentPresenter 
Content="{Binding ElementName=txtCaseNumber, Path=(Validation.Errors).CurrentItem}" />

Additionally,
System.Windows.Controls.Validation.GetHasError(txtCaseNumber) returns true.

I am hosting WPF in winforms if that makes a difference. I can’t find any references in my code or styles to Validation or ErrorTemplate so I’m pretty sure this isn’t a styling own goal.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T20:48:56+00:00Added an answer on May 16, 2026 at 8:48 pm

    Cracked it.

    The ErrorTemplate attached property uses the adorner layer to show error templates on data validation failures reported via IDataErrorInfo. The Adorner layer is not always available for all controls in all situations. Your control or one of its parents needs to explicitly provide one.

    The default Window control template contains an AdornerDecorator which enables the adorner layer for its children. This why my other window showed my error templates just fine, because this window used the default control template

    The window which didn’t show my error template had used a style which provided a ControlTemplate for my window. This control template did not provide an <AdornerDecorator>, hence no adorner layer to show my error template.

    The fix was as simple as wrapping my window control template with <AdornerDecorator>.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using c#, VS2005, and .NET 2.0. (XP 32 bit) This is a Winforms app
Ok so this is alittle bit obscure and I'm not sure its the best
I'm not even sure if this is even possible, but I've just started WPF
Im building this Digital Signage prototype for a master thesis. Im using WPF and
Silverlight 4, but I'm not sure if this applys to WPF also. This is
I have this bit of javascript written with jQuery 1.2.5. It's contained inside the
I have this bit of script to widen a text box on mouseover and
I have this bit of code I found on the web at the end
I'm trying to understand this bit of code: in display.php: <html> ... <body> <table>
Well, I have this bit of code that is slowing down the program hugely

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.