SchedulerControl.DateNavigatorQueryActiveViewType Event
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.v18.2.dll
Declaration
Event Data
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. |
Example
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/how-to-switch-the-scheduler-view-by-selecting-a-different-number-of-days-in-the-datenavigator-e4920
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;
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the DateNavigatorQueryActiveViewType event.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.