Share via


TreeView.ItemsSource Property

Definition

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

public:
 property Platform::Object ^ ItemsSource { Platform::Object ^ get(); void set(Platform::Object ^ value); };
/// [get: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
/// [set: Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)]
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 { [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] get; [Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallback(enable=true)] 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; }
var object = treeView.itemsSource;
treeView.itemsSource = object;
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