windowsforms-devexpress-dot-xtrascheduler-dot-schedulercontrol-b1f4bb74.md
Enables you to specify the active view type of the Scheduler when the user selects dates in the bound DateNavigator.
Namespace : DevExpress.XtraScheduler
Assembly : DevExpress.XtraScheduler.v25.2.dll
NuGet Package : DevExpress.Win.Scheduler
public event DateNavigatorQueryActiveViewTypeHandler DateNavigatorQueryActiveViewType
Public Event DateNavigatorQueryActiveViewType As DateNavigatorQueryActiveViewTypeHandler
The DateNavigatorQueryActiveViewType event's data class is DateNavigatorQueryActiveViewTypeEventArgs. The following properties provide information specific to this event:
| Property | Description |
|---|---|
| NewViewType | Gets or sets the type of the view to be used by the scheduler to show its data after the date range selected in the bound DateNavigator has been changed. |
| OldViewType | Gets the type of the view used by the scheduler to show its data before the date range selected in the bound DateNavigator is changed. |
| SelectedDays | Gets the collection of dates selected in the DateNavigator bound to scheduler. |
This example uses the SchedulerControl.DateNavigatorQueryActiveViewType event of the SchedulerControl to conditionally switch the Scheduler view. When an entire week is selected in the Date Navigator, the Scheduler switches to the Week View.
using DevExpress.XtraScheduler;
using System.Windows.Forms;
void schedulerControl1_DateNavigatorQueryActiveViewType(object sender, DateNavigatorQueryActiveViewTypeEventArgs e)
{
if ((e.SelectedDays.Count == 7) && (e.SelectedDays.Start.DayOfWeek == schedulerControl1.FirstDayOfWeek))
{
e.NewViewType = SchedulerViewType.Week;
}
}
Imports DevExpress.XtraScheduler
Imports System.Windows.Forms
Private Sub schedulerControl1_DateNavigatorQueryActiveViewType(ByVal sender As Object, ByVal e As DateNavigatorQueryActiveViewTypeEventArgs)
If (e.SelectedDays.Count = 7) AndAlso (e.SelectedDays.Start.DayOfWeek = schedulerControl1.FirstDayOfWeek) Then
e.NewViewType = SchedulerViewType.Week
End If
End Sub
See Also