Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TreeView/TreeViewItem ControlTemplates with dotted lines

Tags:

c#

.net

mvvm

wpf

xaml

This seems like it should have such a simple solution, but apparently it doesn't.

I've searched far and wide, and there apparently seems to be no way of adding dotted lines to connect nodes in a TreeView, unlike the WinForms equivalent.

I've found a number of sources online where people have changed the ControlTemplate to one which has the connecting lines. However, when reading through the comments and discussions they all seem to have problems.

How would I go about changing the ControlTemplate to achieve this?

like image 970
Dot NET Avatar asked Dec 05 '12 16:12

Dot NET


1 Answers

As promised I wrote the Control Template to make a WPF TreeView look like the Winform TreeView.

You'll find all the code and files here or here !

Enjoy !

enter image description here

like image 107
Sisyphe Avatar answered Nov 03 '22 01:11

Sisyphe