views:

124

answers:

2

How can I ensure that a button's Tooltip is only visible when the button is disabled?

What can I bind the tooltip's visibility to?

+1  A: 

You will need to set ToolTipService.ShowOnDisabled to True on the Button in order to have the Tooltip visible at all when the Button is disabled. You can bind ToolTipService.IsEnabled on the Button to enable and disable the Tooltip.

Quartermeister
For anyone who wants to do the same things as me, I've posted the full xaml for the button as an answer.Thanks for your help.
David Ward
A: 
<Button 
  x:Name="btnAdd" 
  Content="Add" 
  ToolTipService.ShowOnDisabled="True" 
  ToolTipService.IsEnabled="{Binding ElementName=btnAdd, Path=IsEnabled, Converter={StaticResource boolToOppositeBoolConverter}}" 
  ToolTip="Appointments cannot be added whilst the event has outstanding changes."/>
David Ward