1
votes

I put a

<TreeView></TreeView>

on a Page, but these erros appears:

TreeView is not supported in a Windows Universal project.

The type 'TreeView' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.

Unknown type 'TreeView' in XML namespace 'http://schemas.microsoft.com/winfx/2006/xaml/presentation'

On the Project this is set:

<TargetPlatformMinVersion>10.0.16299.0</TargetPlatformMinVersion>

Project properties

How to use the TreeView (and HierarchicalDataTemplate) in a UWP Project?

2

2 Answers

3
votes

TreeView control was originally planned for the Windows 10 Fall Creators Update, but was scraped from the release in the end. It is believed this happened because to have this control properly supported, HierarchicalDataTemplate should be introduced to UWP first to have a proper support for data binding and templating the control.

However, the current version of the source code, which is compatible with Fall Creators Update and is implemented using ListView is available on GitHub, so you can include it in your project manually. It is built as a C++ Windows Runtime Component, which means it is compatible with all Windows Runtime languages including C#.

0
votes

TreeView is now included on the Windows 10 build 17134 (also known as the April Update or version 1803)

So we can target this version and then use this XAML:

<TreeView></TreeView>

It does not seem to support HierarchicalDataTemplate yet.

See the annoucement: https://docs.microsoft.com/en-us/windows/uwp/whats-new/windows-10-build-17134

TreeView documentation: https://docs.microsoft.com/en-us/windows/uwp/design/controls-and-patterns/tree-view