wpf tooltip on mouseover and mouseout

24,608

Solution 1

Your question isn't completely clear, and I'm not sure what you're looking for, but the things that will affect ToolTip duration follow:

ToolTipService.InitialShowDelay - Length of time in milliseconds between hovering over a control and when the tooltip appears. 0 = instant.

ToolTipService.ShowDuration - Length of time in milliseconds a tooltip will hang around while the mouse is over it. Setting it really high will be effectively a "never turn off" option, but there isn't a true always option.

ToolTipService.BetweenShowDelay - Once a tooltip pops up, this is the amount of time that must pass before InitialShowDelay is again observed.

Example:

<TextBox ToolTipService.InitialShowDelay="5000" 
ToolTipService.ShowDuration="2000" 
ToolTipService.BetweenShowDelay="10000" 
ToolTip="This is a tool tip." />

With this, when you hover over the TextBox, a tooltip will show up after five seconds. It will hang around for two seconds. And until you haven't looked at a tooltip for 10 seconds, there will be no delay between hover and pop-up.

Solution 2

If you just set ToolTip="Message". Your message will be shown only when the mouse is on the control.

Share:
24,608
nitefrog
Author by

nitefrog

BY DAY: Envangilze open source technologies and roll up the sleeves to play! BY NIGHT: Write poetry and short stories into the wee hours of the morning. FOR FUN: Read a ton, live a lot, and drink as much coffee as I am humanly able.

Updated on July 09, 2022

Comments

  • nitefrog
    nitefrog almost 2 years

    What I am trying to do is have the tool tip show once a mouse over occurs. The ToolTip will not turn off until a mouse out.

    Only a mouse out will allow the ToolTip to close.

    The customer has a requirement where they want the ToolTip to stay up indefinite until a mouse out happens.

    Additional: Is there a way only to close the tooltip on mouse out, and not mouse move?

    The area that the mouse will be over is a rectangle and only when I move out of the rectangle should the tool tip close.

    Thanks.

  • nitefrog
    nitefrog about 13 years
    What I am trying to have it do is once a mouse over the ToolTip will not turn off until a mouse out. Only a mouse out will allow the ToolTip to close. That is what I am trying to do. I hope that is clearer. The customer has a requirement where they want the ToolTip to stay up indefinite until a mouse out happens. Thanks!
  • Bryan Walker
    Bryan Walker about 13 years
    Yeah, then I think the best you can do is make the ShowDuration REALLY big. If you do 360,000,000, that'll last 100 hours, which is a long time for a mouse cursor to stay in one place.
  • nitefrog
    nitefrog about 13 years
    Thanks. Is there a way only to close it on mouse out and not mouse move? The area is a rectangle and only when I move out of the rectangle should the tool tip close. Thanks again.
  • Bryan Walker
    Bryan Walker about 13 years
    In my test project I set up to look at this, the tooltip stays up as long as the cursor stays within the control that has the tooltip. So on the TextBox sample, as long as the mouse doesn't leave the TextBox once the tooltip comes up, the tooltip shouldn't go anywhere.