WPF:更改滑块c#上的工具提示格式 [英] WPF: change tooltip format on a slider c#
本文介绍了WPF:更改滑块c#上的工具提示格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在c#中定义了这样一个滑块:
I have a slider in c# defined like this:
<Slider HorizontalAlignment="Center" x:Name="rain_0"
Margin="3"
VerticalAlignment="Top"
Width="250"
Minimum="0" Maximum="1" IsSnapToTickEnabled="True" TickFrequency="0.1" AutoToolTipPrecision="1" AutoToolTipPlacement="BottomRight" ValueChanged="Slider_ValueChanged"/>
工具提示显示下一格式滑块的值:0,0。
我希望工具提示显示格式为0.0的值。有没有简单的方法来实现这个?我查了一下ThumbToolTipValueConverter,但在我的情况下,也许是因为我的目标很复杂。另一种更好的方法是?
The tooltip shows the value of the slider with next format: 0,0 .
I want the tooltip displays the value with format 0.0 instead. Any easy way to acomplish this? I checked a bit about "ThumbToolTipValueConverter" but in my case maybe is to complex for my objetive. Another better way?
推荐答案
逗号来自您的区域设置。
如果它们是例如英语你会看到一点。
下面的文章展示了如何修改自动工具提示。
http://joshsmithonwpf.wordpress.com/2007/09/14/modifying-the -auto-tooltip-of-a-slider / [ ^ ]
另一种方法可能是压制自动工具提示
并在滑块下面显示一个文本块,它是绑定到滑块的数据。
然后你可以使用你喜欢的任何值转换器。
The comma comes from your regional settings.
If they were e.g. English you would see a point.
The article below shows how you can modify the auto tool tip.
http://joshsmithonwpf.wordpress.com/2007/09/14/modifying-the-auto-tooltip-of-a-slider/[^]
Another way could be to suppress the auto tool tip
and show a text block below the slider which is data bound to the slider.
Then you could use any value converter you like.
这篇关于WPF:更改滑块c#上的工具提示格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文