WPF-自定义Slider的AutoToolTipFormat
参考:https://www.cnblogs.com/TianFang/archive/2009/07/04/1517027.html
其中,在FormatAutoToolTipContent函数中可以修改对输入格式的转换逻辑,比如转换成日期格式,如下所示:
private void FormatAutoToolTipContent()
{
if (!string.IsNullOrEmpty(this.AutoToolTipFormat))
{
long content = long.Parse(AutoToolTip.Content.ToString().Replace(",", ""));
DateTime dt = new DateTime(content);
this.AutoToolTip.Content = dt.ToString(AutoToolTipFormat);
}
}
本文来自博客园,作者:MaQaQ,转载请注明原文链接:https://www.cnblogs.com/magicMaQaQ/p/16008484.html
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文链接,否则保留追究法律责任的权利。