Its actually not much work. Check this example:
The Designer part:
<Window x:Class="MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfApplication1"
Title="MainWindow"
Height="400"
Width="600">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.Resources>
<HierarchicalDataTemplate DataType="{x:Type local:Dummy}"
ItemsSource="{Binding Path=.}">
<StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=ID}" />
<TextBlock Text=" - " />
<TextBlock Text="{Binding Path=Name}" />
</StackPanel>
<ItemsControl Margin="30,0,0,0"
ItemsSource="{Binding Data}" />
</StackPanel>
</HierarchicalDataTemplate>
</Grid.Resources>
<ListView x:Name="lst" />
<Button Grid.Row="1"
Margin="0,10,0,5"
Content="Add items from code behind"
Click="ManuallyAdded_Click" />
<Button Grid.Row="2"
Margin="0,5,0,10"
Content="Clear Listview"
Click="Clear_Click" />
<Button Grid.Row="3"
Content="Bind listview to source"
Click="SourceBinding_Click" />
</Grid>
</Window>
Code behind:
Imports System.Collections.ObjectModel
Class MainWindow
Private Sub ManuallyAdded_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
ResetItems()
For i As Integer = 0 To 10
Dim dum As Dummy = CreateDummy(i)
GetDummies(dum)
lst.Items.Add(dum)
Next
End Sub
Private Sub SourceBinding_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
Dim source As New List(Of Dummy)
For i As Integer = 0 To 10
Dim dum As Dummy = CreateDummy(i)
GetDummies(dum)
source.Add(dum)
Next
ResetItems()
lst.ItemsSource = source
End Sub
Private Sub Clear_Click(sender As System.Object, e As System.Windows.RoutedEventArgs)
ResetItems()
End Sub
Private Sub GetDummies(parent As Dummy)
For i As Integer = 0 To 10
parent.Data.Add(CreateDummy(i))
Next
End Sub
Private Function CreateDummy(i As Integer) As Dummy
Return New Dummy With {.ID = i, .Name = "Dummy" & i}
End Function
Private Sub ResetItems()
lst.ItemsSource = Nothing
lst.Items.Clear()
End Sub
End Class
Public Class Dummy
Public Property ID() As Integer
Public Property Name() As String
Public Property Data() As New ObservableCollection(Of Dummy)
End Class
Hope it helps.