1. Add RadSchedulerNavigator and a RadScheduler. Change the view type to Week View.
2. Associate the RadSchedulerNavigator to RadScheduler. Change the PC's time zone to (UTC-03:00) Brasilia Time zone
3. Change the PC's date to 21 Oct 2016 and run the application.
4. When you change the time zone in RadSchedulerNavigator to (UTC-03:00) Brasilia Time zone, you will notice that the ruler starts from 23.
Workaround:
public Form1()
{
InitializeComponent();
radSchedulerNavigator1.AssociatedScheduler = radScheduler1;
this.radScheduler1.ActiveViewChanged += radScheduler1_ActiveViewChanged;
this.radScheduler1.CellElementMouseDown += radScheduler1_CellElementMouseDown;
this.radScheduler1.AppointmentEditDialogShowing += radScheduler1_AppointmentEditDialogShowing;
radScheduler1.ActiveViewType = Telerik.WinControls.UI.SchedulerViewType.Week;
}
DateTime? date = null;
private void radScheduler1_CellElementMouseDown(object sender, MouseEventArgs e)
{
SchedulerCellElement cell = this.radScheduler1.ElementTree.GetElementAtPoint(e.Location) as SchedulerCellElement;
if (cell != null)
{
date = cell.Date;
}
}
CustomEditAppointmentDialog dialog = null;
private void radScheduler1_AppointmentEditDialogShowing(object sender, AppointmentEditDialogShowingEventArgs e)
{
if (dialog == null)
{
dialog = new CustomEditAppointmentDialog();
}
e.AppointmentEditDialog = dialog;
if (date != null && !e.Appointment.Start.Equals(date))
{
e.Appointment.Start = (DateTime)date;
}
date = null;
}
private void radScheduler1_ActiveViewChanged(object sender, Telerik.WinControls.UI.SchedulerViewChangedEventArgs e)
{
SchedulerDayView dayView = e.NewView as SchedulerDayView;
SchedulerWeekView weekView = e.NewView as SchedulerWeekView;
if (dayView != null || weekView != null)
{
RulerPrimitive ruler = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewElement).DataAreaElement.Ruler;
ruler.GetType().GetField("defaultOffset", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).SetValue(ruler, 0.0f);
}
}
public class CustomEditAppointmentDialog : EditAppointmentDialog
{
protected override void LoadSettingsFromEvent(IEvent sourceEvent)
{
base.LoadSettingsFromEvent(sourceEvent);
this.dateStart.Value = sourceEvent.Start;
this.timeStart.Value = sourceEvent.Start;
}
}