What are the uses of WPF tools

TreeView introduction

This article has been localized into German by the community.

If you are fluent in German, then please help us - just point to any untranslated element (highlighted with a yellow left border - remember that images should have their titles translated as well!) inside the article and click the translation button to get started. Or have a look at the current translation status for the German language.

If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.


Please help us by translating the following metadata for the article / chapter, if they are not already translated.

If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed.Please only submit an altered translation of a metadata item if you have good reasons to do so!

Please login to translate metadata!Already logged in? Please try reloading the page!
The TreeView control:

The TreeView element enables hierarchical data to be displayed, with each data value being represented by a node in the tree. Each node can have further sub-nodes and these sub-nodes in turn and so on. If you've used Windows Explorer you know what a TreeView looks like - it is the control element that shows the current folder structure on your computer on the left side of the Explorer.

The difference of the TreeView in WPF and WinForms

If you've worked with the TreeView Element in WinForms, you might think that the TreeView Element is easy to use but difficult to customize. In WPF it's a bit the other way around, at least for beginners: it feels a bit complicated when you start working with it, but it's MUCH easier to adjust afterwards. Like many other WPF controls, the TreeView element looks like little at first when you start out. But it can be adjusted with little effort almost without limits.

Just like the ListView element, the TreeView control has its own item type, the TreeViewItem. It can be used to fill the TreeView with data. If you come from the WinForms world, you will probably start by generating TreeViewItems and then adding them to the Items property. This is also possible in WPF. But since this is WPF, the best way is to bind the TreeView element to a hierarchical data structure and to use a suitable template to display the control element.

We'll show you both ways. While the good ol 'WinForms inspired path may seem like an easy choice at first, you should definitely give the WPF art a try - in the long run it offers more flexibility and the results will better match the rest of the code you will be writing with WPF .


The WPF TreeView element is a really complex control. In the first example, which we will look at in the next chapter, it may look simple, but as soon as you dig deeper, you will notice the complexity. Fortunately, the TreeView control rewards you with great usability and flexibility. To show you all that, we have created a separate category for all TreeView articles. Just click Next and we'll begin.

This article has been fully translated into the following languages: Is your preferred language not on the list? Click here to help us translate this article into your language!