Язык

ObservableCollectionListSource<T> Класс

Определение

ObservableCollection<T> Расширяет и добавляет явную реализациюIListSource.

[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BindingList raises ListChanged events with PropertyDescriptors. PropertyDescriptors require unreferenced code.")]
[System.Runtime.CompilerServices.Nullable(new System.Byte[] { 0, 1 })]
public class ObservableCollectionListSource<T> : System.Collections.ObjectModel.ObservableCollection<T>, System.ComponentModel.IListSource where T : class
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
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("BindingList raises ListChanged events with PropertyDescriptors. PropertyDescriptors require unreferenced code.")>]
[<System.Runtime.CompilerServices.Nullable(new System.Byte[] { 0, 1 })>]
type ObservableCollectionListSource<'T (requires 'T : null)> = class
    inherit ObservableCollection<'T (requires 'T : null)>
    interface IListSource
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

Параметры типа

T

Тип элементов в коллекции.

Наследование
ObservableCollectionListSource<T>
Атрибуты
Реализации

Комментарии

Метод GetList() реализуется для возврата IBindingList реализации, которая остается в синхронизации с ObservableCollection.

Этот класс можно использовать для реализации свойств навигации для сущностей, используемых в привязке данных Windows Forms. Для привязки данных WPF используется observableCollection, а не экземпляр этого класса.

Дополнительные сведения и примеры см. в локальных представлениях отслеживаемых сущностей в EF Core .

Конструкторы

Имя. Описание
ObservableCollectionListSource<T>()

Инициализирует новый экземпляр класса ObservableCollectionListSource<T>.

ObservableCollectionListSource<T>(IEnumerable<T>)

Инициализирует новый экземпляр ObservableCollectionListSource<T> класса, содержащего элементы, скопированные из указанной коллекции.

ObservableCollectionListSource<T>(List<T>)

Инициализирует новый экземпляр ObservableCollectionListSource<T> класса, содержащего элементы, скопированные из указанного списка.

Явные реализации интерфейса

Имя. Описание
IListSource.ContainsListCollection

Всегда имеет значение false, так как никогда не существует автономной коллекции.

IListSource.GetList()

Возвращает реализацию IBindingList , которая остается в синхронизации с этим ObservableCollection<T>. Возвращаемый список кэшируется в этом объекте, таким образом, что один и тот же список возвращается каждый раз при вызове этого метода.

Методы расширения

Имя. Описание
ToBindingList<T>(ObservableCollection<T>)

BindingList<T> Возвращает реализацию, которая остается в синхронизации с заданнымObservableCollection<T>.

Применяется к