I want to create something like a TreeView with the ListView Control. There are two classes with the same base-class like this:
public abstract class DataObjectBase
{
public string Name { get; set; }
public override string ToString()
{
return this.Name;
}
}
public class SimpleDataObject : DataObjectBase
{
public object Value { get; set; }
}
public class ComplexDataObject : DataObjectBase
{
private ObservableCollection<DataObjectBase> _DataObjects = new ObservableCollection<DataObjectBase>();
public ObservableCollection<DataObjectBase> DataObjects
{
get { return _DataObjects; }
set { _DataObjects = value; }
}
}
How can I bind this structure to a ListView using a HirarchicalDataTemplate? The complex DataObject can have n subelements in the _DataObjects ObservableCollection.