blazor-devexpress-dot-blazor-dot-dxschedulerrecurrencesettings.md
Specifies how many times recurrent appointments occur.
Namespace : DevExpress.Blazor
Assembly : DevExpress.Blazor.v25.2.dll
NuGet Package : DevExpress.Blazor
public int OccurrenceCount { get; set; }
| Type | Description |
|---|---|
| Int32 |
An integer value that specifies the number of occurrences.
|
You can access this nested property as listed below:
| Object Type | Path to OccurrenceCount |
|---|---|
| DxSchedulerDataStorage |
.RecurrenceSettings .OccurrenceCount
|
Use the OccurrenceCount property to specify how many times all recurrent appointments occur. To change this count for an individual appointment, use the DxSchedulerRecurrenceInfo.OccurrenceCount property.
The following code snippet specifies an occurrence count for recurrent appointments. The Meeting 1 and Meeting 2 appointments occur 3 times (the RecurrenceSettings.OccurrenceCount property is applied). The Meeting 3 appointment occurs 10 times (the DxSchedulerRecurrenceInfo.OccurrenceCount property is applied).
@using Data
<DxScheduler StartDate="@DateTime.Today" DataStorage="@DataStorage">
<DxSchedulerWeekView ShowWorkTimeOnly="true" />
</DxScheduler>
@code {
DxSchedulerDataStorage DataStorage = new DxSchedulerDataStorage() {
RecurrenceSettings = new DxSchedulerRecurrenceSettings {
OccurrenceCount = 3
},
AppointmentsSource = RecurrentAppointmentCollection.GetAppointments(),
AppointmentMappings = new DxSchedulerAppointmentMappings() {
Type = "AppointmentType",
Start = "StartDate",
End = "EndDate",
Subject = "Caption",
AllDay = "AllDay",
Location = "Location",
Description = "Description",
LabelId = "Label",
StatusId = "Status",
RecurrenceInfo = "Recurrence"
}
};
}
using System;
namespace Scheduler.Data
{
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 int? ResourceId { get; set; }
public bool Accepted { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Globalization;
namespace Scheduler.Data {
public static partial class RecurrentAppointmentCollection {
public static List<Appointment> GetAppointments() {
DateTime date = DateTime.Today;
var dataSource = new List<Appointment>() {
new Appointment {
AppointmentType = 1,
Caption = "Meeting 1",
StartDate = date + (new TimeSpan(0, 9, 00, 0)),
EndDate = date + (new TimeSpan(0, 10, 00, 0)),
Label = 5,
Status = 4,
Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" Frequency =\"1\" Id=\"cd9da802-d166-47d1-a8df-1101fcc50d53\"/>", ToString(date + (new TimeSpan(0, 9, 00, 0))))
},
new Appointment {
AppointmentType = 1,
Caption = "Meeting 2",
StartDate = date + (new TimeSpan(1, 12, 00, 0)),
EndDate = date + (new TimeSpan(1, 13, 00, 0)),
Label = 8,
Status = 2,
Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" Frequency =\"1\" Id=\"15129fd3-9eb0-4861-8c43-c61844137f17\"/>", ToString(date + (new TimeSpan(1, 12, 00, 0))))
},
new Appointment {
AppointmentType = 1,
Caption = "Meeting 3",
StartDate = date + (new TimeSpan(0, 15, 00, 0)),
EndDate = date + (new TimeSpan(0, 16, 00, 0)),
Label = 10,
Status = 1,
Recurrence = string.Format("<RecurrenceInfo Type=\"0\" Start=\"{0}\" Range=\"1\" OccurrenceCount=\"10\" Frequency =\"1\" Id=\"72e3db8f-cdb6-4aaa-afe1-e3c6b80ce995\"/>", ToString(date + (new TimeSpan(0, 15, 00, 0))))
}
};
return dataSource;
}
private static string ToString(DateTime dateTime) {
return dateTime.ToString(CultureInfo.InvariantCulture);
}
}
}
See Also
DxSchedulerRecurrenceSettings Class