David Veeneman
David Veeneman

Reputation: 19122

How to supress WPF tool tips?

Is there a way to supress WPF tool tips, other than by setting their content to null?

I am extending the Calendar control to provide date highlighting, using Charles Petzold's MSDN article as a guide. As per the article, I use a value converter to return a string if a date on in the Calendar was found in a date list. The string (number of appointments for the day, for example) is displayed as a tool tip when the mouse is over the date. If the date wasn't found in the list, the value converter returns null.

Overall, it's pretty cool, but I'd like to provide an option to turn the tool tips off and just show highlighting. I am already using a null value when a date is not found, so that a tooltip is not displayed for that date. The null value also supresses the highlighting for that date. So, I can't simply return a blanket null if tool tips are turned off, because it would turn off the highlighting, as well.

I tried creating the tool tip in a separate tag and giving it a name, so that I could use a data trigger to turn it on and off. No go-- a tool tip is considered a property, and while it will compile as a separate object, it throws a runtime exception.

I also tried returning a coded value, 'NOSHOW' if the date was not found in the date list, so that I could use null to supress tool tips. Unfortunately, that gives every unhighlighted date a tool tip that says NOSHOW.

So, at this point I am scratching my head. Any suggestions as to how I can get this done? Thanks for your help!

Upvotes: 3

Views: 425

Answers (1)

NVM
NVM

Reputation: 5552

ToolTipService.IsEnabled=False

<TextBox ToolTipService.IsEnabled="False" />

Upvotes: 2

Related Questions