ObservableCollectionListSource<T> 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
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 窗体数据绑定中使用。 对于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>的实现保持同步。 |