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);
            }
        }

posted @ 2022-03-15 15:02  MaQaQ  阅读(101)  评论(0编辑  收藏  举报