wpf: how to show tooltip when button disabled by command?

I’m trying to show a tooltip regardless of a buttons state, but this does not seem to do the trick:

<Button Command="{Binding Path=CommandExecuteAction}" 
        ToolTip="{Binding Path=Description}" ToolTipService.ShowOnDisabled="true"
        Style="{StaticResource toolbarButton}">
   <Image Source="{Binding Path=Icon}"></Image>
</Button>

How can i show the tooltip when the button is disabled due to command.CanExecute returning false?

Note:

ToolTipService.ShowOnDisabled=”true” works like a charm. The reason this didn’t work in my example is because the style associated with the button redefines the controltemplate and turned off hit-testing on the button when the button was disabled (IsHitTestVisible=false). Re-enabling hit-testing in the controltemplate made the tooltip appear when the button was disabled.

3 Answers
3

Leave a Comment