API

ObservableCollection<T>.CollectionChanged

Signals collection changes such as additions, removals, replacements, moves and resets. Editing a property on a contained object is a separate notification contract. Mutate a UI-bound collection on its owning UI thread unless an explicit synchronization strategy is used.

Formal Syntax & Structure

csharp syntaxcsharp
items.CollectionChanged += handler;

Working Example

Example Snippetcsharp
using System;using System.ComponentModel;using System.Collections.ObjectModel;using System.Windows.Input;var items=new ObservableCollection<int>(); items.CollectionChanged+=(_,e)=>Console.WriteLine(e.Action); items.Add(5); // Add
C# & .NET Reference