Share via


TreeView.ItemsSource Proprietà

Definizione

Ottiene o imposta un'origine oggetto usata per generare il contenuto di TreeView.

Questa documentazione si applica a WinUI 2 per UWP (per WinUI nella SDK per app di Windows, vedere gli spazi dei nomi SDK per app di Windows).

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"/>

Valore della proprietà

Object

Platform::Object

IInspectable

Oggetto utilizzato per generare il contenuto di TreeView. Il valore predefinito è Null.

Attributi
Microsoft.UI.Xaml.CustomAttributes.MUXPropertyChangedCallbackAttribute

Commenti

Il valore della proprietà ItemsSource deve implementare una di queste interfacce:

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

ItemsControl può offrire prestazioni migliori se il valore della proprietà ItemsSource implementa anche un'interfaccia elenco di accesso casuale:

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

ItemsControl può rispondere alle modifiche se il valore della proprietà ItemsSource implementa anche un'interfaccia di notifica delle modifiche:

C++ .NET
IObservableVector<IInspectable> Inotifycollectionchanged

Si applica a