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:
public class ChatDataItemCollection : IEnumerable, INotifyCollectionChanged
Inheritance: objectChatDataItemCollection
Implements:
Constructors
Initializes a collection associated with a chat messages view.
public ChatDataItemCollection(ChatMessagesViewElement owner)
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.
public int Count { get; }
public bool IsReadOnly { get; }
Gets the view that owns this collection.
public ChatMessagesViewElement Owner { get; }
Gets or replaces an item at the specified index.
public BaseChatDataItem this[int index] { get; set; }
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.
public void Add(BaseChatDataItem item)
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.
public void AddRange(IEnumerable<BaseChatDataItem> items)
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.
protected virtual void AdjustMessageTypes()
Removes all items and detaches them from the owning chat view.
public void Clear()
public void CopyTo(BaseChatDataItem[] array, int arrayIndex)
Inserts an item at the specified index, assigns its owner, invokes grouping-marker updates, and refreshes the view.
public void Insert(int index, BaseChatDataItem item)
The zero-based position at which to insert the item.
itemBaseChatDataItemThe item to insert.
Inserts multiple items at the specified index and invokes grouping-marker updates.
public void InsertRange(int index, IEnumerable<BaseChatDataItem> items)
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.
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
The change action and associated item data.
Removes the specified item if present, then invokes grouping-marker updates and refreshes the view.
public bool Remove(BaseChatDataItem item)
The item to remove.
Returns:Removes the item at the specified index, detaches it from the view, invokes grouping-marker updates, and refreshes the view.
Events
Occurs when items are added, removed, or the collection is cleared.
public event NotifyCollectionChangedEventHandler CollectionChanged
Implements: