Lorsque l'on affiche un ToolTip dans un ItemControl avec un binding de donnée il arrive parfois que l'un des items ne doive pas afficher son ToolTip, par exemple si le text à afficher est vide.
Pour celà, il suffit de créer un Trigger sur le control qui "affiche" le tooltip.
<TextBlock Text="{Binding Path=Alias}" VerticalAlignment="Center" >
<TextBlock.ToolTip>
<TextBlock Text="{Binding Path=Description}" />
</TextBlock.ToolTip>
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding Description}"
Value="">
<Setter Property="ToolTipService.IsEnabled"
Value="False" />
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>



There are no comments yet...Kick things off by filling out the form below.