Nollie
Nollie

Reputation: 151

Display value of slider using XAML

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?

Upvotes: 7

Views: 11227

Answers (1)

Clemens
Clemens

Reputation: 128146

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

<Slider ... AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0" />

Upvotes: 15

Related Questions