Good evening,
I Have the working code XAML + Powershell:
<TabItem Header="Tasks" Visibility="Collapsed" Name="TabTasks">
<TabItem.Resources>
<HierarchicalDataTemplate x:Key="ClosuresDataTemplate" ItemsSource="{Binding Status2Closure}" >
<Grid>
<CheckBox IsChecked="True" Content="{Binding TaskStatus}"/>
<CheckBox IsChecked="True" Content="{Binding TaskClosure}"/>
</Grid>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="StatusDataTemplate" ItemsSource="{Binding Types2Status}" ItemTemplate="{StaticResource ClosuresDataTemplate}">
<CheckBox IsChecked="True" Content="{Binding TaskType}"/>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate x:Key="TypesDataTemplate" ItemsSource="{Binding TasksTypes}" ItemTemplate="{StaticResource StatusDataTemplate}">
<TextBlock Text="Task types, status and closure reason tree"/>
</HierarchicalDataTemplate>
</TabItem.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="20"/>
<RowDefinition Height="250"/>
<RowDefinition Height="20"/>
<RowDefinition Height="250"/>
<RowDefinition Height="20*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1000*"/>
<ColumnDefinition Width="100"/>
<ColumnDefinition Width="100"/>
</Grid.ColumnDefinitions>
<TreeView Name="TreeTest" Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="1" Grid.RowSpan="6" HorizontalContentAlignment="Stretch" Background="LightSlateGray" ItemTemplate="{StaticResource TypesDataTemplate}"/>
</Grid>
</TabItem>
Data send by PS with:
$wpf.TreeTest.ItemsSource = $dts.DefaultViewManager
$dts is a DataSet with 3 tables and 2 relations on primary keys.
This works but I get a useless root node for "TypesDataTemplate". I tried to plug the treeview to"StatusDataTemplate" but then nothing appear anymore.
I'm bit confused about what is happening there.