我需要能够更改滑块上的刻度,以下代码似乎仅在第一次调用时才起作用。我有什么想法我做错了吗?
private void ApplyTicks()
{
try
{
this.timeSlider.Ticks.Clear();
if (this.ticks != null)
{
DoubleCollection tickMarks = new DoubleCollection();
foreach (double tick in this.ticks)
{
tickMarks.Add(tick);
}
if (tickMarks.Count <= 0)
{
tickMarks.Add(0.0);
}
this.timeSlider.Ticks = tickMarks;
log4net.LogManager.GetLogger("StreamCodersVideoPlayerControl.ApplyTicks").Debug("Ticks applied.");
}
}
catch (Exception e)
{
WPFMessageBox.Show("Error", e.Message);
log4net.LogManager.GetLogger("StreamCodersVideoPlayerControl.ApplyTicks").Error("Error: " + e.Message);
}
}