TimeSlotCollection.Add(TimeSpan, String) Method
Appends a new time slot with the specified value and display name to the collection.
Namespace: DevExpress.XtraScheduler
Assembly: DevExpress.XtraScheduler.v24.1.Core.Desktop.dll
NuGet Package: DevExpress.Scheduler.CoreDesktop
Declaration
Parameters
Name | Type | Description |
---|---|---|
val | TimeSpan | A TimeSpan value that specifies the value of the time slot. This value is assigned to the TimeSlot.Value property. |
displayName | String | A String value that specifies the display name of the time slot. This value is assigned to the UserInterfaceObject.DisplayName property and is displayed as a menu caption in the context menu. |
Returns
Type | Description |
---|---|
Int32 | An integer value indicating the position at which the new element was inserted. |
Remarks
This method creates a new TimeSlot object, initializes it with the specified values and adds it to the end of the collection.
To add a custom time slot to the collection, add default time slots first and then add a custom time slot, as illustrated in the following code snippet:
// Add 20-minute time slots to the view.
scheduler.DayView.TimeSlots.AddRange(scheduler.DayView.DefaultTimeSlots);
scheduler.DayView.TimeSlots.Add(new DevExpress.XtraScheduler.TimeSlot(new TimeSpan(0, 20, 0), "20 minutes"));