New Here?
My name is Nir and I'm the founder of Nbd-Tech, this blog is about things that interest me, so you can find posts on productivity, running a software company and obscure technological topics.
If you like what you read you can
subscribe to the blog feed or
follow me on twitter.
If you use WPF’s data binding with validation a red border appears around controls with invalid values, you can also use the Validation.ErrorTemplate attached property to get a better look for the invalid controls.
But – if you try this you’ll discover that there’s a new tab stop on you from, the red frame (or your own template) now accepts focus, breaking tab navigation.
The problem is that that the validation framework will add a control to the adorner layer in order to display the error indicator – and this control is focusable.
To fix it just add the following to the Window’s resources (or the application resources).
<Style TargetType="{x:Type Control}">
<Setter Property="Focusable" Value="False"/>
</Style>
This shouldn’t cause any problems because almost no one uses Control itself and this style will not affect subclasses, but you still have to test everything after the change.
posted @ Sunday, May 25, 2008 3:44 PM