Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

TreeViewItem.ItemsSource Property

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

Property Value

Object

Platform::Object

IInspectable

The object that is used to generate the content of the TreeViewItem. 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> or INotifyCollectionChanged INotifyCollectionChanged

Applies to


Feedback

Was this page helpful?