Stores date intervals for Scheduler views and routes mutations through optional change callbacks. Single-item insertions are ordered by start date and reject intersections with existing intervals.
Definition
Namespace:Telerik.WinControls.UI
Assembly:Telerik.WinControls.Scheduler.dll
Syntax:
public class DateTimeIntervalCollection : Collection<DateTimeInterval>, IList, ICollection, IEnumerable
Inheritance: objectCollection<DateTimeInterval>DateTimeIntervalCollection
Implements:
Inherited Members
Constructors
Initializes an empty interval collection without a change handler.
public DateTimeIntervalCollection()
Initializes the collection with the specified intervals, rejecting any interval that intersects one already added.
public DateTimeIntervalCollection(IEnumerable<DateTimeInterval> intervals)
The intervals to add; null is treated as an empty sequence.
Exceptions: InvalidOperationExceptionAn input interval intersects an earlier interval in the sequence.
Initializes an empty interval collection that delegates change approval and notifications to a handler.
public DateTimeIntervalCollection(IListChangeHandler<DateTimeInterval> listChangeHandler)
The handler used before and after accepted changes.
Fields
Stores the handler that can cancel changes and receive post-change notifications.
protected IListChangeHandler<DateTimeInterval> listChangeHandler
Methods
Adds an interval from midnight on the start date through the last second of the end date.
Adds an interval beginning at midnight on startDate with a duration of
dayCount days minus one second.
Adds intervals in input order after checking each one for intersections with intervals already in the collection. It does not sort the range or check for intersections between items in the input sequence. The input sequence is enumerated twice and must be repeatable.
public virtual void AddRange(IEnumerable<DateTimeInterval> intervalCollection)
The repeatable sequence of intervals to add.
Exceptions: ArgumentNullExceptionintervalCollection is null.
An input interval intersects an interval already in the collection.
Begins a nestable update batch that suppresses the public CollectionChanged event until the outer batch ends. The configured handler still receives a callback for each accepted change.
public void BeginUpdate()
Removes all intervals unless the change handler cancels the operation.
protected override void ClearItems()
Overrides:
Ends one update batch and requests a reset notification when the outermost batch ends.
public void EndUpdate()
Inserts an interval in ascending order by its start date.
protected void InsertInterval(DateTimeInterval interval)
The interval to insert.
Validates and inserts an interval by start date; the requested collection index does not determine its final position.
protected override void InsertItem(int index, DateTimeInterval item)
The requested insertion index.
itemDateTimeIntervalThe interval to insert.
Exceptions: InvalidOperationExceptionThe interval intersects an existing interval.
Overrides:
Determines whether any interval in the collection intersects the specified interval.
public virtual bool IntersectsWith(DateTimeInterval dateTimeInterval)
The interval to compare with the collection.
Returns:Notifies the handler after a change and raises CollectionChanged outside an update batch.
protected virtual void OnCollectionChanged(ListChangedEventArgs<DateTimeInterval> args)
The applied change.
Gives the configured handler an opportunity to cancel a proposed change.
protected virtual bool OnCollectionChanging(ListChangedEventArgs<DateTimeInterval> args)
The proposed change.
Returns:true when the collection may apply the change; otherwise, false.
Removes the interval at the specified index unless the change handler cancels the operation.
protected override void RemoveItem(int index)
The zero-based index of the interval to remove.
Overrides:
Rejects replacement of an interval at a collection index.
protected override void SetItem(int index, DateTimeInterval item)
The index of the interval to replace.
itemDateTimeIntervalThe replacement interval.
Exceptions: InvalidOperationExceptionIndexed replacement is unsupported; add intervals through the collection's Add methods.
Overrides:
Events
Occurs after a collection change, or once with a reset notification when an update batch ends.
public event EventHandler<ListChangedEventArgs<DateTimeInterval>> CollectionChanged