Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display value of slider using XAML

Tags:

c#

wpf

slider

How to display current Value of slider only while it's clicked? Something like tooltip but not on mouse-over.

This code gives me value of slider on mouse-over and it's shown as double value:

<Slider x:Name="slider" HorizontalAlignment="Left" Maximum="100" Margin="76,10,0,0" VerticalAlignment="Top" Width="184" ToolTipService.ToolTip="{Binding Path=Value, ElementName=slider}" Value="80"/>

How do I modify it to receive integer value and only when the slider it's clicked?

like image 838
Nollie Avatar asked Oct 28 '16 12:10

Nollie


1 Answers

Instead of explicitly setting a ToolTip, set the AutoToolTipPlacement and AutoToolTipPrecision properties, e.g.

<Slider ... AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0" />
like image 174
Clemens Avatar answered Oct 29 '22 10:10

Clemens