<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>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)