I have classes like this:
public class A : INotifyPropertyChanged
{
public ObservableCollection<A> Children { get; set; }
}
public class B : A
{
}
public class C : A
{
public ObservableCollection<A> Children2 { get { return Children; } }
}
And i'm trying to bind them using HierarchicalDataTemplate
like this:
<HierarchicalDataTemplate DataType="{x:Type local:B} ItemSource="{Binding Children}">
<TextBlock Text="foo"/>
</HierarchicalDataTemplate>
<HierarchicalDataTemplate DataType="{x:Type local:C} ItemSource="{Binding Children2}">
<TextBlock Text="bar"/>
</HierarchicalDataTemplate>
Which results in B beeing not expandable (as if nothing was bound) while C works just fine.
How do I bind to base class property without need to expose it again in derived class?