I have a WPF screen that displays a number of TextBox inputs. I have a style that handles all the validation:
<Style x:Key="TextBoxStyle" BasedOn="{x:Null}" TargetType="{x:Type TextBox}">
    <!-- etc etc -->
    <Setter Property="Validation.ErrorTemplate">
        <Setter.Value>
            <ControlTemplate>
                <Border Grid.Column="0" BorderBrush="Red" BorderThickness="1">
                    <StackPanel>
                        <AdornedElementPlaceholder />
                    </StackPanel>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Style.Triggers>
        <Trigger Property="Validation.HasError" Value="True">
            <Setter Property="ToolTip" Value="{Binding RelativeSource={x:Static RelativeSource.Self}, Path=(Validation.Errors)[0].ErrorContent}" />
        </Trigger>
    </Style.Triggers>
</Style>
The only thing I have to apply to the TextBox is to tell the binding that it validates. Seeing as I have quite a number of these boxes over the application, I would prefer not to repeat this ad nauseum for the entire application.
<TextBox Text="{Binding TargetValue, ValidatesOnExceptions=true, ValidatesOnDataErrors=true, NotifyOnValidationError=true}" Style="{DynamicResource TextBoxStyle}" />
I've tried adding the Text.Binding.ValidatesOnDataErrors property to the style, which doesn't work nor seem like the correct way to do it. Is it possible to create a default binding style? Any suggestions appreciated!