Why does WPF Style to show validation errors in ToolTip work for a TextBox but fails for a ComboBox?

Your getting this error because when you validation finds that there are no issues, the Errors collection returns with no items, and the following binding logic fails:

Path=(Validation.Errors)[0].ErrorContent}"

you are accessing the validation collection by a specific index. I'm currently working on a DataTemplate Suggestion for replacing this text.

I love that Microsoft listed this in their standard example of a validation template.

update so replace the code above with the following, and the binding logic will know how to handle the empty validationresult collection:

Path=(Validation.Errors).CurrentItem.ErrorContent}"

(following xaml was added as a comment)

<ControlTemplate x:Key="ValidationErrorTemplate" TargetType="Control">
    <StackPanel Orientation="Horizontal">
        <TextBlock Foreground="Red" FontSize="24" Text="*" 
                   ToolTip="{Binding .CurrentItem}">
        </TextBlock>
        <AdornedElementPlaceholder>
        </AdornedElementPlaceholder>
    </StackPanel>
</ControlTemplate>

Update in 2019

As of currently, the correct path syntax to use is:

Path=(Validation.Errors)/ErrorContent

I think this is the best way:

Path=(Validation.Errors)/ErrorContent

/ is actually equal to CurrentItem by @Nathan

In my case, CurrentItem is a no go.


Try the converter for converting to a multi-line string as described here