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?