ObservableCollectionHelperAddChangeHandlersTCollection, TItem Method | |
Adds a handler to collection that translates collection changes and forwards
them to added, removed and cleared as appropriate.
Namespace: Lawo.ComponentModelAssembly: Lawo (in Lawo.dll) Version: 1.4.1707.27006
Syntax public static NotifyCollectionChangedEventHandler AddChangeHandlers<TCollection, TItem>(
this TCollection collection,
Action<int, TItem> added,
Action<int, TItem> removed,
Action cleared
)
where TCollection : IList, INotifyCollectionChanged
Parameters
- collection
- Type: TCollection
The collection to add the handler to. - added
- Type: SystemActionInt32, TItem
The action to execute when an item is added to the collection. The parameters are the
index at which the item was added, followed by the item. - removed
- Type: SystemActionInt32, TItem
The action to execute when an item is removed from the collection. The parameters are
the index at which the item was removed, followed by the item. - cleared
- Type: SystemAction
The action to execute when all items have been removed from the collection.
Type Parameters
- TCollection
- The type of the collection.
- TItem
- The type of the items in the collection.
Return Value
Type:
NotifyCollectionChangedEventHandlerThe added handler. To stop calls to
added,
removed and
cleared, this handler needs to be removed from
CollectionChanged.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type . When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Exceptions Remarks First calls added for each item collection currently
contains, then adds the handler to CollectionChanged and finally
returns the added handler.
See Also