class Item
{
public string Header { get; }
public ObservableCollection<Items> Children { get; }
public override string ToString() => Header;
}
<LeanPrawn Items="{Binding Items}" ChildSelector="{Binding Children}"/>
- DataTemplate instead of relying on
ToString
- Include
LeanPrawnSource
instead of specifying ChildSelector
on control itself
- Specifying it on control is horthand for creating a
LeanPrawnSource
and setting its ChildSelector
- Content property is
Columns
class Item
{
public string Header { get; }
public ObservableCollection<Items> Children { get; }
}
<LeanPrawn Items="{Binding Items}">
<LeanPrawn.Source>
<LeanPrawnSource ChildSelector="{Binding Children}"/>
</LeanPrawn.Source>
<LeanPrawnColumn>
<DataTemplate>
<TextBlock Text="{Binding Header}/>
</DataTemplate>
</LeanPrawnColumn>
</LeanPrawn>
class Item
{
public string Header { get; }
public int Unread { get; }
public ObservableCollection<Items> Children { get; }
}
<LeanPrawn Items="{Binding Items}" ChildSelector="{Binding Children}">
<LeanPrawnColumn>
<DataTemplate>
<TextBlock Text="{Binding Header}/>
</DataTemplate>
</LeanPrawnColumn>
<LeanPrawnColumn Width="Auto">
<DataTemplate>
<Border CornerRadius="4" Background="Red" IsVisible="{Binding !!Unread}">
<TextBlock Text="{Binding Unread}/>
</Border>
</DataTemplate>
</LeanPrawnColumn>
</LeanPrawn>