Skip to main content

ItemsSource Property

Gets or sets a collection used to generate the content of the ItemsControl.

Definition​

Namespace: Avalonia.Controls
Assembly: Avalonia.Controls (in Avalonia.Controls.dll)

public IEnumerable? ItemsSource { get; set; }

Property Value​

IEnumerable

Remarks​

A common scenario is to use an ItemsControl such as a ListBox to display a data collection, or to bind an ItemsControl to a collection object. To bind an ItemsControl to a collection object, use the ItemsSource property. When the ItemsSource property is set, the Items collection is made read-only and fixed-size. When ItemsSource is in use, setting the property to null removes the collection and restores usage to Items, which will be an empty ItemCollection.

See Also​

Reference​

ItemsControl Class
Avalonia.Controls Namespace