ObservableCollection<T>.OnCollectionChanged Metod

Definition

Genererar händelsen CollectionChanged med de angivna argumenten.

protected:
 virtual void OnCollectionChanged(System::Collections::Specialized::NotifyCollectionChangedEventArgs ^ e);
protected virtual void OnCollectionChanged(System.Collections.Specialized.NotifyCollectionChangedEventArgs e);
abstract member OnCollectionChanged : System.Collections.Specialized.NotifyCollectionChangedEventArgs -> unit
override this.OnCollectionChanged : System.Collections.Specialized.NotifyCollectionChangedEventArgs -> unit
Protected Overridable Sub OnCollectionChanged (e As NotifyCollectionChangedEventArgs)

Parametrar

e
NotifyCollectionChangedEventArgs

Argument för händelsen som genereras.

Exempel

När du åsidosättar den här metoden anropar du antingen basimplementeringen eller använder BlockReentrancy metoden för att hantera ändringar i reentrant-samlingen, som i följande exempel:

using (BlockReentrancy())
{
    // OnCollectionChanged call
}
Using BlockReentrancy()
    ' OnCollectionChanged call
End Using

Kommentarer

Egenskaper och metoder som ändrar den CollectionChanged här samlingen genererar händelsen via den här virtual metoden.

Gäller för