Set Validation Tooltip in CodeBehind instead of XAML
Posted
by KrisTrip
on Stack Overflow
See other posts from Stack Overflow
or by KrisTrip
Published on 2010-05-30T14:17:19Z
Indexed on
2010/05/30
14:22 UTC
Read the original article
Hit count: 254
I would like to know how to translate the following code to codebehind instead of XAML:
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
The part I can't figure out is the Path portion. I have the following but it doesn't work:
new Trigger
{
Property = Validation.HasErrorProperty,
Value = true,
Setters =
{
new Setter
{
Property = Control.ToolTipProperty,
// This part doesn't seem to work
Value = new Binding("(Validation.Errors)[0].ErrorContent"){RelativeSource = RelativeSource.Self}
}
}
}
Help?
© Stack Overflow or respective owner