Tree Lines in WinUI TreeView

29 Apr 20212 minutes to read

The TreeView allows to show the tree lines for treeview nodes by enabling the ShowLines property as true. The default value is false.

<treeView:SfTreeView Name="treeView" ShowLines="True" />
treeView.ShowLines = true;

WinUI TreeView with TreeLines

Enable tree line for root nodes

The TreeView also supports to show the tree lines for root nodes by enabling the ShowRootLines property as true. The default value is false.

<treeView:SfTreeView Name="treeView"    
                       ShowLines="True"
                       ShowRootLines="True" />
treeView.ShowLines = true;
treeView.ShowRootLines = true;

WinUI TreeView displays TreeLines for Root Nodes

Customizing the tree lines

Customizing the line color

The TreeView allows to change the color of tree lines by using the LineStroke property. The default value is SystemBaseMediumLowColor.

<treeView:SfTreeView Name="treeView"    
                       ShowLines="True"
                       ShowRootLines="True"
                       LineStroke="DeepSkyBlue" />
treeView.ShowLines = true;
treeView.ShowRootLines = true;
treeView.LineStroke = new SolidColorBrush(Colors.DeepSkyBlue);

Customizing TreeLines in WinUI TreeView

Customizing the line thickness

The TreeView allows to change the thickness of tree lines by using the LineStrokeThickness property. The default value is 1.

<treeView:SfTreeView Name="treeView"           
                       ShowLines="True"
                       ShowRootLines="True"
                       LineStrokeThickness="1.5" />
treeView.ShowLines = true;
treeView.ShowRootLines = true;
treeView.LineStrokeThickness = 1.5;