HierarchicalDataTemplate Class
Represents a DataTemplate that supports HeaderedItemsControl objects, such as TreeViewItem.
System.Windows.DependencyObject
System.Windows.FrameworkTemplate
System.Windows.DataTemplate
System.Windows.HierarchicalDataTemplate
Namespace: System.Windows
Assembly: System.Windows.Controls (in System.Windows.Controls.dll)
The HierarchicalDataTemplate type exposes the following members.
| Name | Description | |
|---|---|---|
![]() | HierarchicalDataTemplate | Initializes a new instance of the HierarchicalDataTemplate class. |
| Name | Description | |
|---|---|---|
![]() | DataType | Gets or sets the type for which this DataTemplate is intended. (Inherited from DataTemplate.) |
![]() | Dispatcher | Gets the Dispatcher this object is associated with. (Inherited from DependencyObject.) |
![]() | ItemContainerStyle | Gets or sets the Style that is applied to the item container for each child item. |
![]() | ItemsSource | Gets or sets the binding that is used to generate content for the next sublevel in the data hierarchy. |
![]() | ItemTemplate | Gets or sets the DataTemplate to apply to the ItemTemplate property on a generated HeaderedItemsControl, such as a TreeViewItem, to indicate how to display items in the next sublevel in the data hierarchy. |
| Name | Description | |
|---|---|---|
![]() | CheckAccess | Determines whether the calling thread has access to this object. (Inherited from DependencyObject.) |
![]() | ClearValue | Clears the local value of a dependency property. (Inherited from DependencyObject.) |
![]() | Equals(Object) | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) |
![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.) |
![]() | GetAnimationBaseValue | Returns any base value established for a Silverlight dependency property, which would apply in cases where an animation is not active. (Inherited from DependencyObject.) |
![]() | GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) |
![]() | GetType | Gets the Type of the current instance. (Inherited from Object.) |
![]() | GetValue | Returns the current effective value of a dependency property from a DependencyObject. (Inherited from DependencyObject.) |
![]() | LoadContent | Creates the UIElement objects in the DataTemplate. (Inherited from DataTemplate.) |
![]() | MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) |
![]() | ReadLocalValue | Returns the local value of a dependency property, if a local value is set. (Inherited from DependencyObject.) |
![]() | SetValue | Sets the local value of a dependency property on a DependencyObject. (Inherited from DependencyObject.) |
![]() | ToString | Returns a string that represents the current object. (Inherited from Object.) |
The HierarchicalDataTemplate enables you to set a data template for the current level of hierarchical data, as well as, set the template for the next sublevel with the ItemTemplate property. Use a HierarchicalDataTemplate to display hierarchical data in a control, such as a TreeView.
The following example shows two hierarchical data templates declared as resources.
<StackPanel.Resources> <sdk:HierarchicalDataTemplate x:Key="ChildTemplate" > <TextBlock FontStyle="Italic" Text="{Binding Path=Title}" /> </sdk:HierarchicalDataTemplate> <sdk:HierarchicalDataTemplate x:Key="NameTemplate" ItemsSource="{Binding Path=ChildTopics}" ItemTemplate="{StaticResource ChildTemplate}"> <TextBlock Text="{Binding Path=Title}" FontWeight="Bold" /> </sdk:HierarchicalDataTemplate> </StackPanel.Resources>
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.


