public void BringIntoView( TimelineControlBringIntoViewMode mode, object dataItem) { TimelineItem container = ContainerFromItem(dataItem); if (container != null) { Nullable <DateTime> start = TimelineCompactPanel.GetStartDate(container); Nullable <DateTime> end = TimelineCompactPanel.GetEndDate(container); if (IsSetZoomToFit(mode) && start.HasValue && end.HasValue) { TimeSpan duration = end.Value - start.Value; double pixelPerTick = (ActualWidth / 2) / duration.Ticks; TimeSpan newTickTimeSpan = TimeSpan.FromTicks((long)(1D / pixelPerTick)); if (newTickTimeSpan.TotalMinutes < 1) { newTickTimeSpan = TimeSpan.FromMinutes(1); } if (newTickTimeSpan < TickTimeSpan) { TickTimeSpan = newTickTimeSpan; } else { if (ActualWidth / 2 < duration.Ticks * Timeline.GetPixelsPerTick(this)) { TickTimeSpan = newTickTimeSpan; } } WpfUtility.WaitForPriority(DispatcherPriority.Background); } if (IsSetCurrentTime(mode)) { if (start.HasValue) { CurrentTime = start.Value; } else if (end.HasValue) { CurrentTime = end.Value; } } } }