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 Forms 資料綁定。 對於 WPF 資料綁定,請使用 ObservableCollection 而非此類別的實例。
更多資訊與範例請參閱 EF Core中追蹤實體的本地視圖 。
建構函式
| 名稱 | Description |
|---|---|
| ObservableCollectionListSource<T>() |
初始化 ObservableCollectionListSource<T> 類別的新執行個體。 |
| ObservableCollectionListSource<T>(IEnumerable<T>) |
初始化一個包含從指定集合複製元素的類別新實例 ObservableCollectionListSource<T> 。 |
| ObservableCollectionListSource<T>(List<T>) |
初始化一個包含從指定清單複製元素的類別新實例 ObservableCollectionListSource<T> 。 |
明確介面實作
| 名稱 | Description |
|---|---|
| IListSource.ContainsListCollection |
總是假的,因為從來沒有包含的集合。 |
| IListSource.GetList() |
回傳 IBindingList 一個與此 ObservableCollection<T>同步的實作。 回傳的清單會快取在這個物件上,使得每次呼叫此方法時都會回傳相同的清單。 |
擴充方法
| 名稱 | Description |
|---|---|
| ToBindingList<T>(ObservableCollection<T>) |
回傳 BindingList<T> 一個與給定 ObservableCollection<T>保持同步的實作。 |