Completed
Last Updated: 17 Jun 2014 10:07 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 04 Dec 2013 07:24
Category: Scheduler/Reminder
Type: Bug Report
0
FIX. RadScheduler in SchedulerDayView does not display appointments which start is outside RulerEndScale
To reproduce:
- add RadScheduler with several appointments and use the folllowing code:
SchedulerDayView dayView = this.radScheduler1.GetDayView();
dayView.RangeFactor = ScaleRange.QuarterHour;
dayView.RulerStartScale = 7;
dayView.RulerEndScale = 18;

Ensure that you have appointments with start before 7 AM and appointments with start after 18 PM. All appointments with start before 7 AM are displayed at the top of the view, but all appointments with start after 18 PM are not displayed.

Workaround:
public Form1()
{
    InitializeComponent();

    for (int i = 0; i < 20; i++)
    {
        Appointment appointment = new Appointment(DateTime.Now.AddHours(12 + i), TimeSpan.FromMinutes(30), "Summary", "Description");
        appointment.StatusId = 2;
        appointment.BackgroundId = 6;
        this.radScheduler1.Appointments.Add(appointment);
    }

    SchedulerDayView dayView = this.radScheduler1.GetDayView();
    dayView.RangeFactor = ScaleRange.QuarterHour;
    dayView.RulerStartScale = 7;
    dayView.RulerEndScale = 18;

    this.radScheduler1.AppointmentElementFactory = new CustomAppointmentElementFactory();
}

public class CustomAppointmentElementFactory : IAppointmentElementFactory
{
    AppointmentElement IAppointmentElementFactory.CreateAppointmentElement(RadScheduler scheduler, SchedulerView view, IEvent appointment)
    {
        return new CustomAppointmentElement(scheduler, view, appointment);
    }
}

public class CustomAppointmentElement : AppointmentElement
{
    public CustomAppointmentElement(RadScheduler scheduler, SchedulerView view, IEvent appointment) : base(scheduler, view, appointment)
    {
    }

    protected override void OnParentChanged(Telerik.WinControls.RadElement previousParent)
    {
        base.OnParentChanged(previousParent);

        if (this.Scheduler.ActiveViewType == SchedulerViewType.Day)
        {
            if (this.Start.Hour > this.Scheduler.GetDayView().RulerEndScale)
            {
                this.Start = this.Start.Date.AddHours(this.Scheduler.GetDayView().RulerEndScale).AddMinutes(-(int)this.Scheduler.GetDayView().RangeFactor);
            }
        }
    }
}
0 comments