Make a ConvertDateTimeToPoint method for RadTimeLine
At the moment the oppisite exists: ConvertPointToDateTime. But it would be great if ConvertDateTimeToPoint also exists.
If I send a datetime parameter to the method I want it to return the specific point for that date in the timeline.
Pavel R. Pavlov
Posted on:05 Nov 2014 15:41
Such method cannot be implemented because we will be able to detect only the X component of the Point depending on the user click. The Y component will not be available as we will not be able to detect at what height the user has clicked. This is why we will not be able to correctly return the corresponding point.
Here is a sample code which calculates only the X component based on given date:
DateTime date = new DateTime(2011, 1, 1);
var pixelsPerTick = this.RadTimeline1.ActualWidth / (this.RadTimeline1.VisiblePeriodEnd.Ticks - this.RadTimeline1.VisiblePeriodStart.Ticks);
var pointX = (date - this.RadTimeline1.VisiblePeriodStart).Ticks * pixelsPerTick;