Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#WPF滑块控制使刻度均匀显示_C#_Wpf - Fatal编程技术网

C#WPF滑块控制使刻度均匀显示

C#WPF滑块控制使刻度均匀显示,c#,wpf,C#,Wpf,我有以下WPF中滑块控件的代码: occuranceTimeSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight; occuranceTimeSlider.IsSnapToTickEnabled = true; occuranceTimeSlider.Ticks = new DoubleCollection()

我有以下WPF中滑块控件的代码:

occuranceTimeSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight;
                occuranceTimeSlider.IsSnapToTickEnabled = true;
                occuranceTimeSlider.Ticks = new DoubleCollection()
                {
                    30, 45, 60, 90, 120, 180, 240, 300, 600, 900, 1200, 1800, 3600, 5400, 7200, 9000, 10800, 14400, 18000 
                };
                occuranceTimeSlider.Minimum = occuranceTimeSlider.Ticks.Min();
                occuranceTimeSlider.Maximum = occuranceTimeSlider.Ticks.Max();
                occuranceTimeSlider.IsSelectionRangeEnabled = false ;
在运行时,滑块几乎可以正常显示和工作。根据两个记号的大小,每个记号之间的距离可变。例如,14400和18000之间的刻度距离远大于30和45之间的刻度距离。有没有办法使这个距离保持不变


谢谢

我能想到的唯一方法(除了重新设置滑块模板)就是在幕后将固定数字转换为指数级。只要您将滑块配置为从不显示数字,您的用户就永远不会知道。

或者只需按如下方式设置刻度:


Ticks=“30、45、60、90、120、180、240、300、600、900、1200、1800、3600、5400、7200、9000、10800、14400、18000”

屏幕截图会有所帮助。如果由于rep的原因,您无法访问,请发布一个链接,有人将进行编辑。