語言

TreeView.ItemsSource 屬性

定義

取得或設定一個用來產生樹狀視圖內容的物件來源。

public:
 property Platform::Object ^ ItemsSource { Platform::Object ^ get(); void set(Platform::Object ^ value); };
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
IInspectable ItemsSource();

void ItemsSource(IInspectable value);
/// [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
IInspectable ItemsSource();

void ItemsSource(IInspectable value);
public object ItemsSource { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] set; }
[Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
public object ItemsSource { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] set; }
var object = treeView.itemsSource;
treeView.itemsSource = object;
Public Property ItemsSource As Object
<TreeView ItemsSource="bindingDeclaration"/>
-or-
<TreeView ItemsSource="resourceReferenceToSource"/>

屬性值

Object

Platform::Object

IInspectable

用來產生 TreeView 內容的物件。 預設是 null。

屬性
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute

備註

ItemsSource 屬性值必須實作以下其中一個介面:

C++ .NET
可怕<可觀察> IEnumerable<物件>
IBindableIterable IEnumerable

如果 ItemsSource 屬性值同時實作隨機存取清單介面,ItemsControl 就能提供更好的效能:

C++ .NET
吸血鬼<可觀察> IList<物件>
IVectorView<可觀察> 僅 IReadOnlyCollection<物件>
IBindableVector 伊利斯主義者
IBindableVectorView 伊利斯主義者

如果 ItemsSource 屬性值同時實作變更通知介面,ItemsControl 就能回應變更:

C++ .NET
IObservableVector<可觀察> INotifyCollection已更改

適用於