HierarchicalDataTemplate.ItemsSource Property

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Gets or sets the binding for this data template, which indicates where to find the collection that represents the next level in the data hierarchy.

Namespace:   System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)

public BindingBase ItemsSource { get; set; }

Property Value

Type: System.Windows.Data.BindingBase

The default is null.

This is applied to the ItemsSource property on a generated HeaderedItemsControl (such as a MenuItem or a TreeViewItem) to indicate where to find the collection that represents the next level in the data hierarchy.

For XAML information, see the Binding type.

In the following example, ListLeagueList is a list of League objects. Each League object has a Name and a collection of Division objects. Each Division has a Name and a collection of Team objects, and each Team object has a Name.

The example shows that with the use of HierarchicalDataTemplate, you can easily display list data that contains other lists. The following is a screenshot of the example.

HierarchicalDataTemplate sample screen shot

.NET Framework
Available since 3.0
Silverlight
Available since 3.0
Windows Phone Silverlight
Available since 7.0
Return to top
Show: