I have Server, which has a list of Databases.
I have Database which has a list of Tables and Views.
I have a helper property called Children on Database which consists of a Union between Tables and Views.
Below is my TreeView Xaml for this, which works great! Except, i want to have a static node for Tables and Views with Tables and Views listed under these static nodes. How do i achieve this?
<TreeView Name="tvServer">
<TreeView.Resources>
<!-- Server -->
<HierarchicalDataTemplate DataType="{x:Type ostsql:Server}" ItemsSource="{Binding Databases}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="/Ost.Applications.CodeGenerator.Application;component/Images/SqlServer.png" />
<TextBlock Text="{Binding ConnectionString}" />
</StackPanel>
</HierarchicalDataTemplate>
<!-- Database -->
<HierarchicalDataTemplate DataType="{x:Type ostsql:Database}" ItemsSource="{Binding Children}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="/Ost.Applications.CodeGenerator.Application;component/Images/Database.png" />
<TextBlock Text="{Binding Name}" />
</StackPanel>
</HierarchicalDataTemplate>
<!-- Table -->
<DataTemplate DataType="{x:Type ostsql:Table}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="/Ost.Applications.CodeGenerator.Application;component/Images/Table.png" />
<TextBlock Text="{Binding QualifiedName}" />
</StackPanel>
</DataTemplate>
<!-- View -->
<DataTemplate DataType="{x:Type ostsql:View}">
<StackPanel Orientation="Horizontal">
<Image Width="16" Height="16" Margin="3,0" Source="/Ost.Applications.CodeGenerator.Application;component/Images/View.png" />
<TextBlock Text="{Binding QualifiedName}" />
</StackPanel>
</DataTemplate>
</TreeView.Resources>
</TreeView>