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 harus mengimplementasikan salah satu antarmuka ini.

.NET C++/WinRT C++/CX
Objek IEnumerable<> IIterable<IInspectable> IIterable<Objek^>
IEnumerable IBindableIterable 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<Objek^>
Objek IReadOnlyCollection<> IVectorView<IInspectable> IVectorView<Objek^>
IList IBindableVector IBindableVector
IBindableVectorView IBindableVectorView
IBindableObservableVector IBindableObservableVector

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

.NET C++/WinRT C++/CX
INotifyCollectionChanged INotifyCollectionChanged INotifyCollectionChanged
Objek ObservableCollection<> IObservableVector<IInspectable> IObservableVector<Objek^>

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

Berlaku untuk