Edit

Share via


ObservableGroupedCollectionExtensions.RemoveItemAt<TKey,TValue> Method

Definition

Remove the item at index from the first group with key from the source grouped collection. It will not do anything if the group or the item does not exist.

public static void RemoveItemAt<TKey,TValue> (this CommunityToolkit.Common.Collections.ObservableGroupedCollection<TKey,TValue> source, TKey key, int index, bool removeGroupIfEmpty = true);
static member RemoveItemAt : CommunityToolkit.Common.Collections.ObservableGroupedCollection<'Key, 'Value> * 'Key * int * bool -> unit
<Extension()>
Public Sub RemoveItemAt(Of TKey, TValue) (source As ObservableGroupedCollection(Of TKey, TValue), key As TKey, index As Integer, Optional removeGroupIfEmpty As Boolean = true)

Type Parameters

TKey

The type of the group key.

TValue

The type of the items in the collection.

Parameters

key
TKey

The key of the group where the item at index should be removed.

index
Int32

The index of the item to remove in the group.

removeGroupIfEmpty
Boolean

If true (default value), the group will be removed once it becomes empty.

Exceptions

index is less than zero or index is greater than the group elements' count.

Applies to