Bind Treeview In WPF
TreeView Xmal
<TreeView x:Name="TvWorkItem" Grid.Column="0" Grid.Row="2" Background="Black" ItemsSource="{Binding MenuDataSource}" SelectedItemChanged="TreeView_OnSelectedItemChanged"> <TreeView.ItemTemplate > <span style="color:#ff0000;"> <HierarchicalDataTemplate ItemsSource="{Binding ChildItems}"> <TextBlock Text="{Binding Name}" Background="Black" > </span> <TextBlock.Style > <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger Binding="{Binding HasOutStandingTask}" Value="true"> <Setter Property="Foreground" Value="DarkOrange" /> <Setter Property="FontSize" Value="16"></Setter> </DataTrigger> <DataTrigger Binding="{Binding HasOutStandingTask}" Value="false"> <Setter Property="Foreground" Value="Aqua" /> </DataTrigger> </Style.Triggers> </Style> </TextBlock.Style> </TextBlock> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView>