Share via


TreeView.ItemsSource Property

Definition

Gets or sets an object source used to generate the content of the TreeView.

This documentation applies to WinUI 2 for UWP (for WinUI in the Windows App SDK, see the Windows App SDK namespaces).

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
<TreeView ItemsSource="bindingDeclaration"/>
-or-
<TreeView ItemsSource="resourceReferenceToSource"/>

Property Value

Object

Platform::Object

IInspectable

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

Attributes
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute

Remarks

The ItemsSource property value must implement one of these interfaces:

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

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

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

The ItemsControl can respond to changes if the ItemsSource property value also implements a change notification interface:

C++ .NET
IObservableVector<IInspectable> INotifyCollectionChanged

Applies to