I tried the following way to extend style and add tooltip message if validationresult is true. But it shows error "Property style is set more than once". How can I extend style for this case. Any help will be appreciated. Thanks.
<TextBox Width="500" Style="{StaticResource HasInvalidValue}">
<TextBox.Text>
<Binding Path="Text" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<Validator:PathFormatValidationRule/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
<TextBox.Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource HasInvalidValue}">
<Style>
<Setter Property="ToolTip" Value="Enter Text."/>
</Style>
</TextBox.Style>
</TextBox>
And the style is defined as:
<Style x:Key="HasInvalidValue" TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="Background" Value="White"/>
<Setter Property="ToolTip"
Value="{Binding RelativeSource={x:Static RelativeSource.Self},
Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>