Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
265
ultraTimeLine synchronize date
posted

Is there a possible way to synchronize the date changed by the timelineViews scroll bar

with calendarinfo?

Thanks.

Parents
  • 69832
    Suggested Answer
    Offline posted

    You can do something like the following to set the ActiveDay to the date of the first DateTime displayed by the control:

    using Infragistics.Win;
    using Infragistics.Win.UltraWinSchedule;

    this.timeLineView.ColumnHeaderInitializing += new ColumnHeaderInitializingHandler(timeLineView_ColumnHeaderInitializing);

    void timeLineView_ColumnHeaderInitializing(object sender, ColumnHeaderInitializingEventArgs e)
    {
        UltraTimelineView control = sender as UltraTimelineView;
        UltraCalendarInfo calendarInfo = control.CalendarInfo;
        DateTime activeDate = calendarInfo.ActiveDay != null ? calendarInfo.ActiveDay.Date : DateTime.Today;

        if ( e.DateTimeInterval.IsPrimaryInterval )
        {
            DateTimeRange range = e.DateTimeRange;
            if ( range.StartDateTime.Date != activeDate )
                calendarInfo.ActivateDay( range.StartDateTime.Date );
        }
    }

    The control exposes a 'SynchronizeWithActiveDay' property, but this works in the other direction, that is, when the ActiveDay changes, the control hears this and brings that date into view. The reason the property is not bi-directional is that TimelineView is similar to DayView in the sense that it displays time slots, but also can be displaying multiple days (or weeks, months, years for that matter) so the concept of "which day is it displaying" gets murky.

    After coding the above, I realized that we really should have an event that fires when the first visible DateTime displayed by the control changes, so I entered a bug along those lines. This functionality will be available in a forthcoming service release.

Reply Children