treeview with + and lines

essamce 581 Reputation points


hi, how to make treeview with node symbol as + symbol (instead of triangle) which converts to - symbol when expanded, and how to add lines (dash lines) that makes it easy to follow the intendations of the tree.
thanks in advance

Windows Presentation Foundation
Windows Presentation Foundation
A part of the .NET Framework that provides a unified programming model for building line-of-business desktop applications on Windows.
2,289 questions
No comments
{count} votes

2 answers

Sort by: Newest
  1. DaisyTian-1203 11,506 Reputation points

    You can use Shape.StrokeDashArray to draw dotted lines for the TreeViewItems.You can replace the HorLn and VerLn in the demo which provided by Castorix31 like below:

     <!-- Connecting dotted Lines -->  
                                <!-- Horizontal line -->  
                                <Rectangle x:Name="HorLn" Height="1" VerticalAlignment="Center" StrokeDashArray="4 4" HorizontalAlignment="Stretch" Stroke="#8888" Margin="9,0,0,0" SnapsToDevicePixels="True"/>  
                                <!-- Vertical line -->  
                                <Rectangle x:Name="VerLn" Width="1" VerticalAlignment="Stretch" StrokeDashArray="4 4" HorizontalAlignment="Center" Stroke="#8888" Grid.RowSpan="2" SnapsToDevicePixels="True"/>  

    Here is the whole code for you to test.

    1 person found this answer helpful.
    No comments

  2. Castorix31 69,016 Reputation points

    You can see for example : WPF TreeView with WinForms Style Fomat

    1 person found this answer helpful.
    No comments