New to Telerik UI for WinForms? Start a free 30-day trial

Stores the virtualized chat view's data items and maintains their message grouping as the list changes.

Appending an item can insert a time-separator item through the owner view. List mutations also update the view and raise CollectionChanged, except where a member's documentation notes otherwise.

Definition

Namespace:Telerik.WinControls.UI

Assembly:Telerik.WinControls.UI.dll

Syntax:

C#
public class ChatDataItemCollection : IEnumerable, INotifyCollectionChanged

Inheritance: objectChatDataItemCollection

Implements: IEnumerableINotifyCollectionChanged

Constructors

Initializes a collection associated with a chat messages view.

C#
public ChatDataItemCollection(ChatMessagesViewElement owner)
Parameters:ownerChatMessagesViewElement

The non-null view used to decide time-separator placement and refresh the displayed items.

Properties

Gets the number of stored items, including any time-separator items.

C#
public int Count { get; }
C#
public bool IsReadOnly { get; }

Gets the view that owns this collection.

C#
public ChatMessagesViewElement Owner { get; }

Gets or replaces an item at the specified index.

C#
public BaseChatDataItem this[int index] { get; set; }
Parameters:indexint

The setter replaces only the list entry; it does not update item ownership or message grouping, refresh the view, or raise CollectionChanged.

Methods

Appends an item, optionally inserting a time separator, assigns its owner, and refreshes the chat view.

C#
public void Add(BaseChatDataItem item)
Parameters:itemBaseChatDataItem

The message data item to append.

Adjacent items from the same author receive first, middle, or last grouping values. If the view was scrolled to the bottom before the update, it remains at the bottom.

Appends each supplied item while deferring per-item view updates, then refreshes the view once.

C#
public void AddRange(IEnumerable<BaseChatDataItem> items)
Parameters:itemsIEnumerable<BaseChatDataItem>

The items to append.

A single Add notification is raised after enumeration completes. If enumeration throws, items already appended remain in the list, but the final view refresh and collection notification are skipped. The method also does not restore its internal update-suspension state, so subsequent calls to Add(BaseChatDataItem) may not refresh the view or raise their usual notifications.

Updates message grouping markers according to neighboring authors after a list mutation. The current implementation leaves the middle marker unchanged for a three-item collection and can leave the penultimate marker stale in larger collections.

C#
protected virtual void AdjustMessageTypes()

Removes all items and detaches them from the owning chat view.

C#
public void Clear()
C#
public bool Contains(BaseChatDataItem item)
Parameters:itemBaseChatDataItemReturns:

bool

C#
public void CopyTo(BaseChatDataItem[] array, int arrayIndex)
Parameters:arrayBaseChatDataItem[]arrayIndexint
C#
public IEnumerator<BaseChatDataItem> GetEnumerator()
Returns:

IEnumerator<BaseChatDataItem>

C#
public int IndexOf(BaseChatDataItem item)
Parameters:itemBaseChatDataItemReturns:

int

Inserts an item at the specified index, assigns its owner, invokes grouping-marker updates, and refreshes the view.

C#
public void Insert(int index, BaseChatDataItem item)
Parameters:indexint

The zero-based position at which to insert the item.

itemBaseChatDataItem

The item to insert.

Inserts multiple items at the specified index and invokes grouping-marker updates.

C#
public void InsertRange(int index, IEnumerable<BaseChatDataItem> items)
Parameters:indexint

The zero-based position at which to insert the items.

itemsIEnumerable<BaseChatDataItem>

The items to insert.

Unlike Insert(int, BaseChatDataItem), this method does not assign the owning view to the inserted items before refreshing the view. The current grouping-marker logic can also leave a marker stale when inserting into or creating a three-item run.

Raises the CollectionChanged event.

C#
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
Parameters:eNotifyCollectionChangedEventArgs

The change action and associated item data.

Removes the specified item if present, then invokes grouping-marker updates and refreshes the view.

C#
public bool Remove(BaseChatDataItem item)
Parameters:itemBaseChatDataItem

The item to remove.

Returns:

bool

true if the item was found and removed; otherwise, false.

Removes the item at the specified index, detaches it from the view, invokes grouping-marker updates, and refreshes the view.

C#
public void RemoveAt(int index)
Parameters:indexint

The zero-based index of the item to remove.

Events

Occurs when items are added, removed, or the collection is cleared.

C#
public event NotifyCollectionChangedEventHandler CollectionChanged

Implements: INotifyCollectionChanged.CollectionChanged