Search code examples
c#wpfxamltooltip

Forcing a WPF tooltip to stay on the screen


I have a tooltip for a Label and I want it to stay open until the user moves the mouse to a different control.

I have tried the following properties on the tooltip:

StaysOpen="True"

and

ToolTipService.ShowDuration = "60000"

But in both cases the tooltip is only displayed for exactly 5 seconds.

Why are these values being ignored?


Solution

  • Just put this code in initialization section.

    ToolTipService.ShowDurationProperty.OverrideMetadata(
        typeof(DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue));