Nollie Nollie - 1 year ago 143
C# Question

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?

Answer Source

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

<Slider ... AutoToolTipPlacement="TopLeft" AutoToolTipPrecision="0" />
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download