ItemsControl.ItemsSource Properti

Definisi

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

public:
 property Platform::Object ^ ItemsSource { Platform::Object ^ get(); void set(Platform::Object ^ value); };
IInspectable ItemsSource();

void ItemsSource(IInspectable value);
public object ItemsSource { get; set; }
var object = itemsControl.itemsSource;
itemsControl.itemsSource = object;
Public Property ItemsSource As Object
<itemsControl ItemsSource="bindingDeclaration"/>
-or-
<itemsControl ItemsSource="resourceReferenceToSource"/>

Nilai Properti

Object

Platform::Object

IInspectable

Objek yang digunakan untuk menghasilkan konten ItemsControl. Default adalah null.

Keterangan

Jenis objek yang Anda atur properti ItemsSource ke harus mengimplementasikan salah satu antarmuka ini.

.NET C++/WinRT C++/CX
Objek IEnumerable<> IVector<IInspectable> IIterable<IInspectable>
IEnumerable IBindableObservableVector IBindableIterable

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

.NET C++/WinRT C++/CX
Objek IList<> IVector<IInspectable> IVector<IInspectable>
Objek IReadOnlyCollection<> IVector<IInspectable> IVectorView<IInspectable>
IList IBindableObservableVector IBindableVector
IList IBindableObservableVector IBindableVectorView

ItemsControl dapat meningkatkan peristiwa pemberitahuan yang diubah koleksi jika nilai properti ItemsSource juga mengimplementasikan antarmuka pemberitahuan yang diubah koleksi.

.NET C++/WinRT C++/CX
Aplikasi C#/.NET Core desktop terkelola
System.Collections.Specialized.INotifyCollectionChanged

aplikasi Platform Windows Universal (UWP)
Windows.UI.Xaml.Interop.INotifyCollectionChanged

IObservableVector<IInspectable> IObservableVector<IInspectable>

Untuk .NET, agar peristiwa yang diubah koleksi ditangani, properti ItemsSource juga harus mengimplementasikan antarmuka IList non-generik.

Berlaku untuk