Quantcast
Viewing latest article 10
Browse Latest Browse All 17

#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"/>

Image may be NSFW.
Clik here to view.
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"/>

Image may be NSFW.
Clik here to view.
1023-002


Filed under: Controls Tagged: Controls, Slider, Tooltip, WPF Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 10
Browse Latest Browse All 17

Trending Articles