Sdílet prostřednictvím


ObservableCollectionListSource<T> Třída

Definice

ObservableCollection<T> Rozšiřuje a přidává explicitní implementaci objektu IListSource.

public class ObservableCollectionListSource<T> : System.Collections.ObjectModel.ObservableCollection<T>, System.ComponentModel.IListSource where T : class
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BindingList raises ListChanged events with PropertyDescriptors. PropertyDescriptors require unreferenced code.")]
public class ObservableCollectionListSource<T> : System.Collections.ObjectModel.ObservableCollection<T>, System.ComponentModel.IListSource where T : class
type ObservableCollectionListSource<'T (requires 'T : null)> = class
    inherit ObservableCollection<'T (requires 'T : null)>
    interface IListSource
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BindingList raises ListChanged events with PropertyDescriptors. PropertyDescriptors require unreferenced code.")>]
type ObservableCollectionListSource<'T (requires 'T : null)> = class
    inherit ObservableCollection<'T (requires 'T : null)>
    interface IListSource
Public Class ObservableCollectionListSource(Of T)
Inherits ObservableCollection(Of T)
Implements IListSource

Parametry typu

T

Typ prvků v kolekci.

Dědičnost
ObservableCollectionListSource<T>
Atributy
Implementuje

Poznámky

Metoda GetList() je implementovaná tak, aby vrátila IBindingList implementaci, která zůstává synchronizovaná s ObservableCollection.

Tuto třídu lze použít k implementaci navigačních vlastností entit pro použití v datové vazbě model Windows Forms. Pro datovou vazbu WPF použijte ObservableCollection místo instance této třídy.

Další informace a příklady najdete v tématu Místní zobrazení sledovaných entit v EF Core .

Konstruktory

ObservableCollectionListSource<T>()

Inicializuje novou instanci ObservableCollectionListSource<T> třídy .

ObservableCollectionListSource<T>(IEnumerable<T>)

Inicializuje novou instanci ObservableCollectionListSource<T> třídy, která obsahuje prvky zkopírované ze zadané kolekce.

ObservableCollectionListSource<T>(List<T>)

Inicializuje novou instanci ObservableCollectionListSource<T> třídy, která obsahuje prvky zkopírované ze zadaného seznamu.

Explicitní implementace rozhraní

IListSource.ContainsListCollection

Vždy false, protože kolekce nikdy není obsažena.

IListSource.GetList()

Vrátí implementaci IBindingList , která zůstává synchronizovaná s touto ObservableCollection<T>funkcí . Vrácený seznam je uložen v mezipaměti tohoto objektu tak, aby se při každém zavolání této metody vrátil stejný seznam.

Metody rozšíření

ToBindingList<T>(ObservableCollection<T>)

Vrátí implementaci BindingList<T> , která zůstává synchronizovaná s daným ObservableCollection<T>parametrem .

Platí pro