blazor-devexpress-dot-blazor-dot-ischedulerrecurrenceinfo-d36a9b31.md
Specifies the recurrence range’s type.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
SchedulerRecurrenceRange Range { get; set; }
| Type | Description |
|---|---|
| SchedulerRecurrenceRange |
A SchedulerRecurrenceRange enumeration value.
|
Available values:
| Name | Description | Value |
|---|---|---|
| NoEndDate |
The recurrence range has no end date, and the appointment repeats indefinitely. The End and OccurrenceCount property values are ignored.
|
0
| | OccurrenceCount |
The range ends after its recurrence count exceeds the value specified by the OccurrenceCount property. The End property value is ignored.
|
1
| | EndByDate |
A recurrent appointment ends after the date specified by the End property. The OccurrenceCount property value is ignored.
|
2
|
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 OccurrenceCount property values are ignored.
| |
|
The range ends after its recurrence count exceeds the specified value. (the OccurrenceCount property value). The End property value is ignored.
| |
|
A recurrent appointment ends after the specified date (the End property value). The OccurrenceCount property value is ignored.
|
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;
}
}
}
public class Appointment {
public Appointment() {}
public int AppointmentType { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string Caption { get; set; }
public string Description { get; set; }
public string Location { get; set; }
public int Label { get; set; }
public int Status { get; set; }
public bool AllDay { get; set; }
public string Recurrence { get; set; }
}
public static partial class RecurringAppointmentCollection {
public static List<Appointment> GetAppointments() {
DateTime date = DateTimeUtils.GetBeginOfMonth(DateTime.Now);
date = DateTimeUtils.GetWeekStart(date);
return new List<Appointment>() {
new Appointment {
AppointmentType = 1,
Caption = "Watercolor Landscape",
Label = 5,
StartDate = date + (new TimeSpan(2, 13, 0, 0)),
EndDate = date + (new TimeSpan(2, 14, 30, 0)),
Recurrence = string.Format("<RecurrenceInfo Start=\"{0}\" End=\"{1}\" WeekDays=\"36\" Id=\"04dcc127-df56-49d7-baff-ce4b6264addd\" OccurrenceCount=\"10\" Range=\"1\" Type=\"1\" />", ToString(date + (new TimeSpan(2, 13, 0, 0))), ToString(date + (new TimeSpan(2, 14, 30, 0)))),
ResourceId = 0
},
new Appointment {
AppointmentType = 1,
Caption = "Oil Painting for Beginners",
Label = 2,
StartDate = date + (new TimeSpan(1, 12, 0, 0)),
EndDate = date + (new TimeSpan(1, 13, 30, 0)),
Recurrence = string.Format("<RecurrenceInfo Start=\"{0}\" End=\"{1}\" WeekDays=\"18\" Id=\"72e3db8f-cdb6-4aaa-afe1-e3c6b80ce99e\" OccurrenceCount=\"10\" Range=\"1\" Type=\"1\" />", ToString(date + (new TimeSpan(1, 12, 0, 0))), ToString(date + (new TimeSpan(1, 13, 30, 0)))),
ResourceId = 0
},
new Appointment {
AppointmentType = 1,
Caption = "Testing",
Label = 8,
StartDate = date + (new TimeSpan(1, 14, 0, 0)),
EndDate = date + (new TimeSpan(1, 15, 0, 0)),
Recurrence = string.Format("<RecurrenceInfo Start=\"{0}\" End=\"{1}\" WeekDays=\"2\" Id=\"15129fd3-9eb0-4861-8c43-c61844137f17\" OccurrenceCount=\"2\" Frequency=\"2\" Range=\"1\" Type=\"1\" />", ToString(date + (new TimeSpan(1, 14, 0, 0))), ToString(date + (new TimeSpan(1, 15, 0, 0)))),
ResourceId = 1
},
new Appointment {
AppointmentType = 1,
Caption = "Meeting of Instructors",
Label = 1,
StartDate = date + (new TimeSpan(1, 10, 0, 0)),
EndDate = date + (new TimeSpan(1, 10, 45, 0)),
Recurrence = string.Format("<RecurrenceInfo Start=\"{0}\" End=\"{1}\" WeekDays=\"62\" Id=\"6de79b21-6b16-4dea-9736-c500058ec858\" OccurrenceCount=\"25\" Range=\"1\" Type=\"1\" />", ToString(date + (new TimeSpan(1, 10, 0, 0))), ToString(date + (new TimeSpan(1, 10, 45, 0)))),
ResourceId = 1
},
new Appointment {
AppointmentType = 1,
Caption = "Monthly Planning",
Label = 1,
StartDate = date + (new TimeSpan(3, 16, 0, 0)),
EndDate = date + (new TimeSpan(3, 17, 0, 0)),
Recurrence = string.Format("<RecurrenceInfo Start=\"{0}\" End=\"{1}\" DayNumber=\"24\" WeekOfMonth=\"0\" Id=\"cd9da802-d166-47d1-a8df-1101fcc50d53\" OccurrenceCount=\"2\" Range=\"1\" Type=\"2\" />", ToString(date + (new TimeSpan(3, 16, 0, 0))), ToString(date + (new TimeSpan(3, 17, 0, 0)))),
ResourceId = 2
},
new Appointment {
AppointmentType = 1,
Caption = "Annual Open Day",
Label = 6,
StartDate = date + (new TimeSpan(27, 10, 30, 0)),
EndDate = date + (new TimeSpan(27, 14, 0, 0)),
Recurrence = string.Format("<RecurrenceInfo Start=\"{0}\" Month=\"{1}\" DayNumber=\"{2}\" WeekOfMonth=\"0\" Id=\"bd5dc726-0fa6-4965-99e0-bf69063218e6\" Type=\"3\" />", ToString(date + (new TimeSpan(27, 10, 30, 0))), (date + (new TimeSpan(27, 10, 30, 0))).Month, (date + (new TimeSpan(27, 10, 30, 0))).Day),
ResourceId = 3
}
};
}
private static string ToString(DateTime dateTime) {
return dateTime.ToString(CultureInfo.InvariantCulture);
}
}
See the DxSchedulerRecurrenceInfo class description for additional information and an example.
See Also
ISchedulerRecurrenceInfo Interface