I can't seem to get it working at all.
The ModelItem has a couple attached properties on it, ValidationState and ValidationError. I'd like to watch the ValidationState and, if Error or whatever, display the error in the tooltip for the control.
Here's as close as I've come so far:
<TextBox
x:Name="expression"
Text="{Binding ModelItem.Expression}">
<TextBox.ToolTip>
<ToolTip>
<ContentControl>
<ContentControl.Style>
<Style
TargetType="ContentControl">
<Style.Triggers>
<DataTrigger
Binding="{Binding ModelItem.ValidationState}">
<DataTrigger.Value>
<v:ValidationState>Error</v:ValidationState>
</DataTrigger.Value>
<Setter
Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock
Text="{Binding ModelItem.ValidationMessage}" />
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
<DataTrigger
Binding="{Binding ModelItem.ValidationState}">
<DataTrigger.Value>
<v:ValidationState>Valid</v:ValidationState>
</DataTrigger.Value>
<Setter
Property="ContentTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock>No Error!</TextBlock>
</DataTemplate>
</Setter.Value>
</Setter>
</DataTrigger>
</Style.Triggers>
</Style>
</ContentControl.Style>
</ContentControl>
</ToolTip>
</TextBox.ToolTip>
</TextBox>
It works; as in, it doesn't blow up the design surface. But it never displays then validation message and displays the Valid template when it is obviously wrong.
Anybody?