TreeViewItem.ItemsSource Properti

Definisi

Mendapatkan atau mengatur sumber objek yang digunakan untuk menghasilkan konten TreeView.

Dokumentasi ini berlaku untuk WinUI 2 untuk UWP (untuk WinUI di SDK Aplikasi Windows, lihat namespace SDK Aplikasi Windows).

public:
 property Platform::Object ^ ItemsSource { Platform::Object ^ get(); void set(Platform::Object ^ value); };
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 { get; 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; }
Public Property ItemsSource As Object
<TreeViewItem ItemsSource="bindingDeclaration"/>
-or-
<TreeViewItem ItemsSource="resourceReferenceToSource"/>

Nilai Properti

Object

Platform::Object

IInspectable

Objek yang digunakan untuk menghasilkan konten TreeViewItem. Defaultnya adalah null.

Atribut
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute

Keterangan

Nilai properti ItemsSource harus mengimplementasikan salah satu antarmuka ini:

C++ .NET
IIterable<IInspectable> Objek IEnumerable<>
IBindableIterable IEnumerable

ItemsControl dapat memberikan performa yang lebih baik jika nilai properti ItemsSource juga mengimplementasikan antarmuka daftar akses acak:

C++ .NET
IVector<IInspectable> Objek IList<>
IVectorView<IInspectable> Objek IReadOnlyCollection<>
IBindableVector IList
IBindableVectorView IList

ItemsControl dapat merespons perubahan jika nilai properti ItemsSource juga mengimplementasikan antarmuka pemberitahuan perubahan:

C++ .NET
IObservableVector<IInspectable> INotifyCollectionChanged

Berlaku untuk