Click here to Skip to main content
15,888,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to add connecting lines in treeview ? this is my xaml code

What I have tried:

<Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*"></RowDefinition>
            <RowDefinition Height="30"></RowDefinition>
        </Grid.RowDefinitions>
        <TreeView Grid.Row="0" Name="tv" ItemsSource="{Binding}">
            <TreeView.Resources>
                <DataTemplate x:Key="childrenDataTemplate">
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Margin="2" Focusable="False" IsChecked="{Binding IsSelected}"  VerticalAlignment="Center" />
                        <Image  Margin="2"  Source="{Binding Converter={StaticResource CustomImagePathConvertor}}"></Image>
                        <TextBlock Margin="2" Text="{Binding Path=DriverName}" />
                    </StackPanel>
                </DataTemplate>
            </TreeView.Resources>
            
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Path=DriverList}" ItemTemplate="{StaticResource ResourceKey=childrenDataTemplate}">
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Margin="2" Focusable="False" IsChecked="{Binding IsSelected}"  VerticalAlignment="Center" />
                        <Image  Margin="2"  Source="{Binding Converter={StaticResource CustomImagePathConvertor}}"></Image>
                        <TextBlock Margin="2" Text="{Binding Path=Category}" />
                    </StackPanel>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
Posted
Comments
Richard Deeming 2-Nov-18 10:01am    
It's not easy, but this StackOverflow answer[^] looks promising.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900