Display value of slider using XAML

左心房为你撑大大i 提交于 2019-12-20 06:08:15

问题


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?


回答1:


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

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


来源:https://stackoverflow.com/questions/40305032/display-value-of-slider-using-xaml

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!