I've got my class:
public class Comment
{
...
public List<Comment> Children;
}
In my ViewModel, I've got a ObservableCollection with my Comments, the binding is working but I would like to bind also the Children.
Here is my View:
<ListBox
ItemsSource="{Binding Comments}"
ItemTemplate="{Binding Source={StaticResource comment}}">
</ListBox>
The template is a UserControl binding for each Comment the content and the children:
<Grid>
<TextBlock Text="{Binding Body}" />
<ListBox
ItemsSource="{Binding Children}"
ItemTemplate="{Binding Source={StaticResource comment}}">
</ListBox>
</Grid>
Obviously I can't bind Children because I need an ObservableCollection but I can't see how to do it, if I replace in my Comment class the List by an ObservableCollection, it's not working neither.
Right now, I list only my Comments in my list in the ViewModel but I would like to do it recursively for each children.
Thanks