TreeView TreeView TreeView TreeView Class


Represents a hierarchical list with expanding and collapsing nodes that contain nested items.

public : class TreeView : Control
struct winrt::Microsoft::UI::Xaml::Controls::TreeView : Control
public class TreeView : Control
Public Class TreeView Inherits Control



For more info, design guidance, and code examples, see Tree view.

If you have the XAML Controls Gallery app installed, click here to open the app and see the TreeView in action.


TreeView() TreeView() TreeView() TreeView()

Initializes a new instance of the TreeView control.


CanDragItems CanDragItems CanDragItems CanDragItems

Gets or sets a value that indicates whether items in the view can be dragged as data payload.

CanDragItemsProperty CanDragItemsProperty CanDragItemsProperty CanDragItemsProperty

Identifies the CanDragItems dependency property.

CanReorderItems CanReorderItems CanReorderItems CanReorderItems

Gets or sets a value that indicates whether items in the view can be reordered through user interaction.

CanReorderItemsProperty CanReorderItemsProperty CanReorderItemsProperty CanReorderItemsProperty

Identifies the CanReorderItems dependency property.

ItemContainerStyle ItemContainerStyle ItemContainerStyle ItemContainerStyle

Gets or sets the style that is used when rendering the item containers.

ItemContainerStyleProperty ItemContainerStyleProperty ItemContainerStyleProperty ItemContainerStyleProperty

Identifies the ItemContainerStyle dependency property.

ItemContainerStyleSelector ItemContainerStyleSelector ItemContainerStyleSelector ItemContainerStyleSelector

Gets or sets a reference to a custom StyleSelector logic class. The StyleSelector returns different Style values to use for the item container based on characteristics of the object being displayed.

ItemContainerStyleSelectorProperty ItemContainerStyleSelectorProperty ItemContainerStyleSelectorProperty ItemContainerStyleSelectorProperty

Identifies the ItemContainerStyleSelector dependency property.

ItemContainerTransitions ItemContainerTransitions ItemContainerTransitions ItemContainerTransitions

Gets or sets the collection of Transition style elements that apply to the item containers of a TreeView.

ItemContainerTransitionsProperty ItemContainerTransitionsProperty ItemContainerTransitionsProperty ItemContainerTransitionsProperty

Identifies the ItemContainerTransitions dependency property.

ItemsSource ItemsSource ItemsSource ItemsSource

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

ItemsSourceProperty ItemsSourceProperty ItemsSourceProperty ItemsSourceProperty

Identifies the ItemsSource dependency property.

ItemTemplate ItemTemplate ItemTemplate ItemTemplate

Gets or sets the DataTemplate used to display each item.

ItemTemplateProperty ItemTemplateProperty ItemTemplateProperty ItemTemplateProperty

Identifies the ItemTemplate dependency property.

ItemTemplateSelector ItemTemplateSelector ItemTemplateSelector ItemTemplateSelector

Gets or sets a reference to a custom DataTemplateSelector logic class. The DataTemplateSelector referenced by this property returns a template to apply to items.

ItemTemplateSelectorProperty ItemTemplateSelectorProperty ItemTemplateSelectorProperty ItemTemplateSelectorProperty

Identifies the ItemTemplateSelector dependency property.

RootNodes RootNodes RootNodes RootNodes

Gets or sets the collection of root nodes of the tree.

SelectedItem SelectedItem SelectedItem SelectedItem
SelectedItems SelectedItems SelectedItems SelectedItems
SelectedNode SelectedNode SelectedNode SelectedNode
SelectedNodes SelectedNodes SelectedNodes SelectedNodes

Gets or sets the collection of nodes that are selected in the tree.

SelectionMode SelectionMode SelectionMode SelectionMode

Gets or sets the selection behavior for a TreeView instance.

SelectionModeProperty SelectionModeProperty SelectionModeProperty SelectionModeProperty

Identifies the SelectionMode dependency property.


Collapse(TreeViewNode) Collapse(TreeViewNode) Collapse(TreeViewNode) Collapse(TreeViewNode)
ContainerFromItem(Object) ContainerFromItem(Object) ContainerFromItem(Object) ContainerFromItem(Object)

Returns the container corresponding to the specified item.

ContainerFromNode(TreeViewNode) ContainerFromNode(TreeViewNode) ContainerFromNode(TreeViewNode) ContainerFromNode(TreeViewNode)
Expand(TreeViewNode) Expand(TreeViewNode) Expand(TreeViewNode) Expand(TreeViewNode)
ItemFromContainer(DependencyObject) ItemFromContainer(DependencyObject) ItemFromContainer(DependencyObject) ItemFromContainer(DependencyObject)

Returns the item that corresponds to the specified, generated container.

NodeFromContainer(DependencyObject) NodeFromContainer(DependencyObject) NodeFromContainer(DependencyObject) NodeFromContainer(DependencyObject)

Returns the TreeViewNode corresponding to the specified container.

SelectAll() SelectAll() SelectAll() SelectAll()

Selects all nodes in the tree.


Collapsed Collapsed Collapsed Collapsed

Occurs when a node in the tree is collapsed.

DragItemsCompleted DragItemsCompleted DragItemsCompleted DragItemsCompleted

Occurs when a drag operation that involves one of the items in the view is ended.

DragItemsStarting DragItemsStarting DragItemsStarting DragItemsStarting

Occurs when a drag operation that involves one of the items in the view is initiated.

Expanding Expanding Expanding Expanding

Occurs when a node in the tree starts to expand.

ItemInvoked ItemInvoked ItemInvoked ItemInvoked

Occurs when an item in the tree is invoked.

Applies to