DayView.Days Property
Gets or sets the days displayed in the DayView.
Namespace: DevExpress.Xpf.Scheduling
Assembly:
DevExpress.Xpf.Scheduling.v24.1.dll
NuGet Package:
DevExpress.Wpf.Scheduling
Declaration
public IEnumerable<DateTime> Days { get; set; }
Public Property Days As IEnumerable(Of Date)
Property Value
The Days property allows you to specify non-consecutive dates to display in the DayView. In an application with a DateNavigator control it allows you to obtain a list of days selected by the end-user.
Note
Navigating the scheduler changes the Days list to a contiguous sequence of dates.
Example
This example implements a custom KeyToCommand behavior to handle Day View navigation. The view displays seven days, Saturday and Sunday excluded. A custom set of days is assigned to the DayView.Days
property.
View Example
<dxmvvm:Interaction.Behaviors>
<dxmvvm:KeyToCommand Command="{DXCommand Execute='MyMoveLeft(@e(scheduler))'}" KeyGesture="Left" />
<dxmvvm:KeyToCommand Command="{DXCommand Execute='MyMoveRight(@e(scheduler))'}" KeyGesture="Right" />
</dxmvvm:Interaction.Behaviors>
public void MyMoveLeft(SchedulerControl scheduler)
{
MyMove(false, scheduler);
}
public void MyMoveRight(SchedulerControl scheduler)
{
MyMove(true, scheduler);
}
public void MyMove(bool forward, SchedulerControl scheduler)
{
if (SchedulerStart.Date == scheduler.Start.Date) return;
FixVisibleDays(forward, scheduler);
SchedulerStart = scheduler.Start;
}
private void FixVisibleDays(bool forward, SchedulerControl scheduler)
{
DayView myView = scheduler.ActiveView as DayView;
DateTime startDate = scheduler.Start;
if (myView != null)
{
DateTimeRange selection = scheduler.SelectedInterval;
startDate = CorrectDate(startDate, forward);
List<DateTime> visibleDays = GetDays(startDate);
// Specify DayView's visible days
myView.Days = visibleDays;
scheduler.SelectedInterval = AdjustSelection(forward, selection);
}
}
Public Sub MyMoveLeft(ByVal scheduler As SchedulerControl)
MyMove(False, scheduler)
End Sub
Public Sub MyMoveRight(ByVal scheduler As SchedulerControl)
MyMove(True, scheduler)
End Sub
Public Sub MyMove(ByVal forward As Boolean, ByVal scheduler As SchedulerControl)
If SchedulerStart.Date = scheduler.Start.Date Then
Return
End If
FixVisibleDays(forward, scheduler)
SchedulerStart = scheduler.Start
End Sub
Private Sub FixVisibleDays(ByVal forward As Boolean, ByVal scheduler As SchedulerControl)
Dim myView As DayView = TryCast(scheduler.ActiveView, DayView)
Dim startDate As Date = scheduler.Start
If myView IsNot Nothing Then
Dim selection As DateTimeRange = scheduler.SelectedInterval
startDate = CorrectDate(startDate, forward)
Dim visibleDays As List(Of Date) = GetDays(startDate)
' Specify DayView's visible days
myView.Days = visibleDays
scheduler.SelectedInterval = AdjustSelection(forward, selection)
End If
End Sub
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Days property.
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.
See Also