New to Telerik UI for WinForms? Download free 30-day trial

Working with Views

The scheduler displays dates and times using a "view" that can be Day, MultiDay, WeekWork WeekMonth and Timeline.

The difference between a day view and a multi-day view is that while the day view is constrained to showing a single sequence of consecutive days (for example 7th through 10th, or 10th through 12th, or just the 15th), the multi-day view can display all of the above sequences at once.

At any one time the scheduler displays a view using a descendant of the SchedulerView class: SchedulerDayView, SchedulerWeekView, SchedulerMonthView and SchedulerTimelineView. Each view has special properties particular to the view. Use the RadScheduler GetDayView(), GetWeekView(), GetMonthView() and GetTimelineView() methods to get the respective views. Here's an example that retrieves the day view and sets the ruler to start at the second hour and stop at the fifth hour:

Get Day View

SchedulerDayView dayView = radScheduler1.GetDayView();
dayView.RulerStartScale = 2;
dayView.RulerEndScale = 5;

Dim dayView As SchedulerDayView = RadScheduler1.GetDayView()
dayView.RulerStartScale = 2
dayView.RulerEndScale = 5

After running the code, the day view for the scheduler looks like this screenshot:

Figure 1: Day View

WinForms RadScheduler Day View

Change between views by changing the ActiveViewType property to one of the SchedulerViewType enumeration members.

ActiveViewType Property

radScheduler1.ActiveViewType = SchedulerViewType.Day;

RadScheduler1.ActiveViewType = SchedulerViewType.Day

Retrieve the view that is currently being displayed by using the ActiveView property, cast it to be the ActiveViewType.

ActiveView Property

radScheduler1.ActiveViewType = SchedulerViewType.Month;
(radScheduler1.ActiveView as SchedulerMonthView).WeekCount = 2;

RadScheduler1.ActiveViewType = SchedulerViewType.Month
TryCast(RadScheduler1.ActiveView, SchedulerMonthView).WeekCount = 2

Figure 2: Week Count

WinForms RadScheduler Week Count

Detect changes to the view by handling the ActiveViewChanging and ActiveViewChanged events. As always, the "Changing" event arguments provide the ability to cancel the view change, but also the "old" and "new" views before and after the view changes transpires:

void radScheduler1_ActiveViewChanging(object sender, SchedulerViewChangingEventArgs e)
{
    this.Text = String.Format("Old: {0} New: {1}",
    e.OldView.ViewType.ToString(), e.NewView.ViewType.ToString());
}

Private Sub radScheduler1_ActiveViewChanging(ByVal sender As Object, ByVal e As SchedulerViewChangingEventArgs)
    Me.Text = String.Format("Old: {0} New: {1}", e.OldView.ViewType.ToString(), e.NewView.ViewType.ToString())
End Sub

See Also

In this article