I have a TextBox with a validation rule that is on a tab of a TabControl. The default ErrorTemplate correctly shows (red border around TextBox) when the validation rule fail
Just an addition for special cases: I was having similar problem and I am now using a solution similar to Dylan's code.
The difference is that my TabItem contains GroupBox and the TextBox is inside it. In this case the AdornerDecorator has to be in the GroupBox itself, not a direct descendand of the TabItem.
So this didn't work:
...
But this did:
...
I am adding it because I couldn't find the solution easily and even the documentation of AdornerLayer.GetAdornerLayer()
(though not sure if it is applicable here) states This static method traverses up the visual tree starting at the specified Visual and returns the first adorner layer found.
- but perhaps it also stops at some point, this is not clear from the docs.