I tried to create a XamTree with following xaml:
<UserControl.Resources> <DataTemplate x:Key="ExpandedIcon"> <Grid> <Image Source="open.png" Height="35" Width="24"/> </Grid> </DataTemplate> <DataTemplate x:Key="CollapsedIcon"> <Grid> <Image Source="close.png" Height="35" Width="24"/> </Grid> </DataTemplate> </UserControl.Resources> <Grid x:Name="LayoutRoot" Background="White" HorizontalAlignment="Stretch"> <ig:XamTree ExpandedIconTemplate="{StaticResource ExpandedIcon}" CollapsedIconTemplate="{StaticResource CollapsedIcon}" > <ig:XamTree.HierarchicalItemTemplate> <ig:HierarchicalDataTemplate ItemsSource="{Binding Children}"> <ig:HierarchicalDataTemplate.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Name}" Foreground="Gray" /> </StackPanel> </DataTemplate> </ig:HierarchicalDataTemplate.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <TextBlock Text="{Binding Name}" FontWeight="Bold"/> </StackPanel> </DataTemplate> </ig:HierarchicalDataTemplate> </ig:XamTree.HierarchicalItemTemplate> </ig:XamTree> </Grid>
Data is loaded from database. with about code, all tree nodes have same icon. I want to different level nodes have different icon. How to resolve this issue?
Hello benjaminswitzer,
This is just a follow up if you require any further assistance.