Completed
Last Updated: 25 Jul 2018 11:01 by Dimitar
ADMIN
Hristo
Created on: 19 Jul 2018 06:23
Category: Scheduler/Reminder
Type: Bug Report
0
FIX. RadScheduler - changing the ruler`s start and end scales results in cells with incorrect dates
How to reproduce:
public partial class RadForm1 : Telerik.WinControls.UI.RadForm
{
    public RadForm1()
    {
        InitializeComponent();
        
        this.radScheduler1.MouseMove += RadScheduler1_MouseMove;
        this.radScheduler1.GroupType = GroupType.Resource;

        Appointment appointment = new Appointment(DateTime.Today.AddHours(13), TimeSpan.FromHours(1), "Test Appointment");
        this.radScheduler1.Appointments.Add(appointment);
    }

    private void RadScheduler1_MouseMove(object sender, MouseEventArgs e)
    {
        Point pt = this.radScheduler1.PointToClient(Cursor.Position);
        SchedulerCellElement cell = this.radScheduler1.SchedulerElement.ElementTree.GetElementAtPoint(pt) as SchedulerCellElement;

        if (cell != null)
        {
            if (cell.Date != null)
            {
                Console.WriteLine(cell.Date.ToShortTimeString());
            }
        }
    }

    private void button1_Click(object sender, EventArgs e)
    {
        switch (this.radScheduler1.ActiveViewType)
        {
            // showing the Day View
            case SchedulerViewType.Day:

                var theDayView = this.radScheduler1.GetDayView();
                if (theDayView != null)
                {
                    RulerPrimitive ruler = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Ruler;
                    ruler.RangeFactor = ScaleRange.QuarterHour;
                    ruler.StartScale = 8;
                    ruler.EndScale = 18;
                }
                break;
        }
    }
}

Workaround: instead of accessing directly the ruler, apply the scaling on the view element
private void button2_Click(object sender, EventArgs e)
{
    switch (this.radScheduler1.ActiveViewType)
    {
        // showing the Day View
        case SchedulerViewType.Day:

            var theDayView = this.radScheduler1.GetDayView();
            if (theDayView != null)
            {
                theDayView.RangeFactor = ScaleRange.QuarterHour;
                theDayView.RulerStartScale = 8;
                theDayView.RulerEndScale = 18;
            }
            break;
    }
}
(Total attached files size should be smaller than 20mb. Allowed extensions: .zip, .rar, .jpg, .png, .gif)
0 comments