Skip to main content
A newer version of this page is available. .

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.v19.2.Core.dll

Declaration

public int Add(
    TimeSpan val,
    string displayName
)

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"));

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Add(TimeSpan, String) method.

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