I am trying to create a simple logging system with a hierarchical ‘feel’. I hope this screen shot explains my object clearly:

As you can see, I create a new object of type LogDetails which exposes just 4 fields:
public string Message;
public LogStatus Status;
public string ErrorDetails;
public enum LogStatus
{
Complete, Failed, Error, FatalError, Progress, Started
}
I have another class which has a Title property (string) and a LogDetails property.
When I bind to XAML, my tree view shows this:

As you can see, the root is fine and expected/desired (red) but each sub category isn’t broken down – I want to be able to bypass a level and go direct to ErrorDetails, Message and Status. So, I would like to create this (mocked up in Word, but hopefully you get the idea):

This is my xaml:
<Grid>
<TreeView ItemsSource="{Binding}">
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding LogDetailsList}" >
<TextBlock Text="{Binding Title}" />
<HierarchicalDataTemplate.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding}" />
</DataTemplate>
</HierarchicalDataTemplate.ItemTemplate>
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
And my MainWindow code behind
public partial class MainWindow : Window
{
static public ObservableCollection<Log> logList;
public MainWindow(List<Log> logs)
{
InitializeComponent();
logList = new ObservableCollection<Log>();
foreach (var item in logs)
{
logList.Add(item);
}
this.DataContext = logList;
}
}
Can anyone please point me in the right direction, or at least let me know if my design is flawed?
EDIT
When I try to add another text block or ItemTEmplate, I get the error message “The property ItemTemplate is set more than once” or “The property VisualTree is set more than once”
You should provide a path to the binding expression.