private TimeSpan ConvertValueToPosition(double value) { double totalSeconds = EndPosition.Subtract(StartPosition).TotalSeconds; double timelineProportion = Minimum != Maximum ? value / (Maximum - Minimum) : 0; double relativeSeconds = totalSeconds * timelineProportion; return(StartPosition.Add(TimeSpan.FromSeconds(relativeSeconds))); }
private double ConvertPositionToValue(TimeSpan position) { TimeSpan relativePosition = position.Subtract(StartPosition); double totalSeconds = EndPosition.Subtract(StartPosition).TotalSeconds; double timelineProportion = totalSeconds != 0 ? relativePosition.TotalSeconds / totalSeconds : 0; double relativeValue = (Maximum - Minimum) * timelineProportion; return(Minimum + relativeValue); }