I have been working with the new WPF 3.5 IDataErrorInfo interface and data binding to business objects.
My window is made up of a TabControl with several TabItems that have TextBoxes that are data bound to business objects that implement the IDataErrorInfo interface.
The problem I was having was that when I switched TabItems and came back to the TabItem with the displayed entry errors, the Validation.Error cues would disappear.
I did a lot of searching and could not find a solution. I even read a bug report about this at: http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=295933
I figured out this was not a data binding problem. The issue is, the Validation.Error cues are painted in the Adorner Layer. When you switch tabs, that layer is discarded.
So I sent Josh Smith an email for suggestion. He knew the answer (of course!).
You must wrap the content of the TabItem in an AdornerDecorator and your problem is solved.
The below code shows the Border control I have placed as the first child of the TabItem. Inside the StackPanel are the TextBoxes, etc.
<Border> <AdornerDecorator> <StackPanel> ... </StackPanel> </AdornerDecorator> </Border>
You can see the * which is my Validation.ErrorTemplate rendering. Using the above AdornerDecorator the user can switch between TabItems and not loose the Validation.Error cues that are painted in the Adorner Layer.
Have a great day,
Just a grain of sand on the worlds beaches.