ISchedulerRecurrenceInfo.Range Property
Specifies the recurrence range’s type.
Namespace: DevExpress.Blazor
Assembly: DevExpress.Blazor.v24.2.dll
NuGet Package: DevExpress.Blazor
#Declaration
SchedulerRecurrenceRange Range { get; set; }
#Property Value
Type | Description |
---|---|
Scheduler |
A Scheduler |
Available values:
Name | Description | Value |
---|---|---|
No |
The recurrence range has no end date, and the appointment repeats indefinitely. The End and Occurrence |
|
Occurrence |
The range ends after its recurrence count exceeds the value specified by the Occurrence |
|
End |
A recurrent appointment ends after the date specified by the End property. The Occurrence |
|
#Remarks
The recurrent appointment reoccurs during the period of time called range. The Start property specifies the range’s start date.
The range’s end date depends on the Range
property value.
Range Type | End Date |
---|---|
The recurrence range has no end date, the appointment repeats indefinitely. The End and Occurrence | |
The range ends after its recurrence count exceeds the specified value. (the Occurrence | |
A recurrent appointment ends after the specified date (the End property value). The Occurrence |
The following example prevents users from creating reccurent appointments that occur only once:
<DxScheduler @bind-StartDate="@StartDate"
DataStorage="@DataStorage"
AppointmentUpdating="AppointmentUpdating"
AppointmentInserting="AppointmentInserting"
AppointmentFormClosing="AppointmentFormClosing">
<DxSchedulerWeekView ShowWorkTimeOnly="true"></DxSchedulerWeekView>
</DxScheduler>
<DxPopup @bind-Visible="@AlertVisible"
CloseOnEscape="true"
CloseOnOutsideClick="true"
ShowCloseButton="true"
HeaderText="Note"
BodyText="The recurrent appointment occurs only once. Increase the appointment count or create a regular appointment.">
</DxPopup>
@code {
bool AlertVisible = false;
bool ValidationFailed = false;
DateTime StartDate { get; set; } = DateTime.Today;
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
AppointmentsSource = RecurringAppointmentCollection.GetAppointments(),
AppointmentMappings = new DxSchedulerAppointmentMappings() {
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status",
RecurrenceInfo = "Recurrence"
}
};
bool IsAppointmentValid(DxSchedulerAppointmentItem appointment) {
if (appointment.IsRecurring &&
appointment.RecurrenceInfo.Range == SchedulerRecurrenceRange.OccurrenceCount &&
appointment.RecurrenceInfo.OccurrenceCount == 1)
return false;
return true;
}
void AppointmentUpdating(SchedulerAppointmentOperationEventArgs e) {
if (!IsAppointmentValid(e.Appointment)) {
e.Cancel = true;
AlertVisible = true;
ValidationFailed = true;
}
}
void AppointmentInserting(SchedulerAppointmentOperationEventArgs e) {
if (!IsAppointmentValid(e.Appointment)) {
e.Cancel = true;
AlertVisible = true;
ValidationFailed = true;
}
}
void AppointmentFormClosing(SchedulerAppointmentFormClosingEventArgs e) {
if (ValidationFailed) {
e.Cancel = true;
ValidationFailed = false;
}
}
}
See the DxSchedulerRecurrenceInfo class description for more information and an example.