Something that I learned a long time ago when I was trying to create a similar interface was that you are better using ListBox than TreeView .
Why?
If you have only one extension level (as you can see from your example), you will have much more control over the layout, since you have one DataTemplate style.
It is much easier to set up a ListBox than a TreeView , since you are not related to the GridViewColumnHeader and GridViewColumnPresenters , etc.
To get part of the extension (which is why you originally selected TreeView ), simply use a Grid with two rows, and Expander in the second row, associated with the IsChecked a ToggleButton property. See the Example I pulled from my Log Viewer.
<DataTemplate> <Grid Margin="0,0,0,3" Grid.IsSharedSizeScope="True"> <Grid.ColumnDefinitions> <ColumnDefinition Width="30" SharedSizeGroup="SSG_TimeIcon"/> <ColumnDefinition Width="120" SharedSizeGroup="SSG_Time"/> <ColumnDefinition Width="30" SharedSizeGroup="SSG_LevelIcon"/> <ColumnDefinition Width="70" SharedSizeGroup="SSG_Level"/> <ColumnDefinition Width="*" SharedSizeGroup="SSG_Message"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Rectangle Grid.Column="0" Grid.Row="0" Margin="0,0,0,0" Width="16" Height="16" VerticalAlignme="Top" HorizoalAlignme="Stretch" Fill="{StaticResource Icon_Timer}"/> <TextBlock Grid.Column="1" Grid.Row="0" Margin="5,0,0,0" VerticalAlignme="Top" HorizoalAlignme="Stretch" Text="{Binding Path=TimeStamp, Converter={StaticResource ObjectToStringConverter}}" ToolTip="{Binding Path=ProgramTime}"/> <Rectangle Grid.Column="2" Grid.Row="0" Margin="10,0,0,0" Width="16" Height="16" VerticalAlignme="Top" HorizoalAlignme="Stretch" Fill="{Binding Path=Level, Converter={StaticResource MappingConverterNinjaLogLevelEnumToBrushResource}}"/> <TextBlock Grid.Column="3" Grid.Row="0" Margin="5,0,0,0" Text="{Binding Path=LevelFriendlyName}" VerticalAlignme="Top" HorizoalAlignme="Stretch"/> <StackPanel Grid.Column="4" Grid.Row="0" Margin="10,0,0,0" Orieation="Horizoal" > <TextBlock Margin="0,0,0,0" Text="{Binding Path=LogMessage}" TextWrapping="Wrap" VerticalAlignme="Top" HorizoalAlignme="Stretch"/> <ToggleButton x:Name="ExpandExceptiooggleButton" VerticalAlignme="Top" Margin="5,0,0,0" IsChecked="False" Coe="Show Details" Tag="Hide Details" Style="{StaticResource TextButtonStyle}" Foreground="{StaticResource BlueBrush}" Background="{StaticResource RedBrush}" Visibility="{Binding Path=HasException, Converter={StaticResource BoolToVisibilityConverter}}" /> </StackPanel> <Expander IsExpanded="{Binding Path=IsChecked, ElemeName=ExpandExceptiooggleButton}" Style="{StaticResource CoeExpanderStyle}" Margin="10,0,0,0" Grid.Column="4" Grid.Row="1"> <Border BorderBrush="{StaticResource DarkGreyBrush}" BorderThickness="1,0,0,0"> <TextBlock Text="{Binding Path=Exception}" Margin="5,0,0,0"/> </Border> </Expander> </Grid> </DataTemplate>
You can see how much easier it is to define a title and an extensible body. If you have a need for nested data, add the Level property to your view model (you use MVVM, don't you?), And then create an IValueConverter that returns a Margin value (i.e. Thickness ) to fake the indent.
Hope this helps if you have any further questions, feel free to ask.