Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Tree view C# - Windows apps | Microsoft Docs

Source: 'https://docs.microsoft.com/en-us/windows/apps/design/controls/tree-view'

The tree view control enables a hierarchical list with expanding and collapsing nodes that contain nested items. It can be used to illustrate a folder structure or nested relationships in your UI.

The tree view uses a combination of indentation and icons to represent the nested relationship between parent nodes and child nodes. Collapsed nodes use a chevron pointing to the right, and expanded nodes use a chevron pointing down.

The chevron icon in TreeView

You can include an icon in the tree view item data template to represent nodes. For example, if you show a file system hierarchy, you could use folder icons for the parent notes and file icons for the leaf nodes.

The chevron and folder icons together in a TreeView

The TreeView APIs support the following features:

  • N-level nesting
  • Selection of single or multiple nodes
  • Data binding to the ItemsSource property on TreeView and TreeViewItem
  • TreeViewItem as the root of the TreeView item template
  • Arbitrary types of content in a TreeViewItem
  • Drag and drop between tree views
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment