I searched and find out I can't set the tooltip in setter.value directly (in a style.xaml file). However I can use static resource to set the tooltip.
My question is, since I need to supply dynamic text for the tooltip, I can't use static resource. How should I do that?
here is my example.
<Style x:Key="ErrorStyleRadius" TargetType="{x:Type FrameworkElement}">
<Style.Triggers>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding (Validation.HasError), RelativeSource={RelativeSource Mode=Self}}" Value="True"/>
<Condition Binding="{Binding (Validation.Errors), RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource IsError}}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="ToolTip">
<Setter.Value>
<ToolTip>
<Label Content="{Binding somePropertyHere}"/>
</ToolTip>
</Setter.Value>
</Setter>
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorControlTemplateRadiusError}"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
<MultiDataTrigger>
<MultiDataTrigger.Conditions>
<Condition Binding="{Binding (Validation.HasError), RelativeSource={RelativeSource Mode=Self}}" Value="True"/>
<Condition Binding="{Binding (Validation.Errors), RelativeSource={RelativeSource Mode=Self}, Converter={StaticResource IsWarning}}" Value="True"/>
</MultiDataTrigger.Conditions>
<MultiDataTrigger.Setters>
<Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors), Converter={StaticResource ValMsg}}"/>
<Setter Property="Validation.ErrorTemplate" Value="{StaticResource ErrorControlTemplateRadiusWarning}"/>
</MultiDataTrigger.Setters>
</MultiDataTrigger>
</Style.Triggers>
</Style>
for usage, i can use as
<textbox style={staticresource ErrorStyleRadius} text={bind name, validationOnDataError=true}/>
Why don't you try this -
You can give the property name in StaticResource. It will update the tooltip dynamically.
Also you can set the tooltip from your style if you want to set the text to Validation.Error like this -