#1,023 – Displaying a Tooltip that Shows the Value of a Slider

You can use the AutoToolTipPlacement property to automatically show a tooltip on a slider while the thumb is being dragged.  The tooltip will show the current Value of the slider.

You can set AutoToolTipPlacement to either BottomRight or TopLeft to control the position of the tooltip.  (The default is None).

Note, however, that the value shown in the tooltip is by default rounded to the nearest integer.  You can see this in the example below, as we display the actual Value in a TextBlock.

        <Slider Name="mySlider" Margin="10"
                Minimum="1" Maximum="100"
                AutoToolTipPlacement="BottomRight"/>

1023-001
You can increase the precision shown in the tooltip by setting the AutoToolTipPrecision property.  You set this property to be the number of digits to the right of the decimal place that you want to see.

        <Slider Name="mySlider" Margin="10"
                Minimum="1" Maximum="100"
                AutoToolTipPlacement="BottomRight"
                AutoToolTipPrecision="2"/>

1023-002

About Sean
Software developer in the Twin Cities area, passionate about software development and sailing.

4 Responses to #1,023 – Displaying a Tooltip that Shows the Value of a Slider

  1. Pingback: Dew Drop – March 6, 2014 (#1737) | Morning Dew

  2. MantasAnni says:

    very simple. thanks!

  3. Papa says:

    am a bit confuse with your code in terms of where iam suppose to insert the code in the xaml. can you help please

    • Sean says:

      I’m not sure what your question is. This post shows an example of a Slider element, which you can use anywhere in your UI that you like.

Leave a comment