ItemsControl.ItemsSource Property

Definition

Gets or sets an object source used to generate the content of the 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"/>

Property Value

Object

Platform::Object

IInspectable

The object that is used to generate the content of the ItemsControl. The default is null.

Remarks

The type of the object that you set the ItemsSource property to must implement one of these interfaces.

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

The ItemsControl can provide better performance if the ItemsSource property value also implements a random-access list interface.

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

The ItemsControl can raise collection-changed notification events if the ItemsSource property value also implements a collection-changed notification interface.

.NET C++/WinRT C++/CX
Managed desktop C#/.NET Core apps
System.Collections.Specialized.INotifyCollectionChanged

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

IObservableVector<IInspectable> IObservableVector<IInspectable>

For .NET, in order for the collection-changed events to be handled, the ItemsSource property must also implement the non-generic IList interface.

Applies to