Hi,
I'm having trouble getting the SfTreeMap control to display heirarchical levels properly.
I have a two-tiered heirarchy consisting of an ObservableCollection<TreeMapDept>, each TreeMapDept of which contains an ObservableCollection<TreeMapSubDept>. In other words:
public class TreeMapSubDept {
public double TreeMapWeight;
public double TreeMapLeafLabel;
// various business attributes
}
public class TreeMapDept {
public ObservableCollection<TreeMapSubDept> TreeMapSubDepts;
public double TreeMapWeight;
public double TreeMapLeafLabel;
// various business attributes
}
public class ViewModel {
public ObservableCollection<TreeMapDept> Depts;
}
My XAML looks like this:
I am able to display the flat level of Depts with the following XAML:
<TreeMap:SfTreeMap
ItemsSource="{Binding Depts}"
WeightValuePath="TreeMapWeight"
LeafLabelPath="TreeMapLeafLabel">
<TreeMap:SfTreeMap.LeafColorMapping>
<TreeMap:DesaturationColorMapping />
</TreeMap:SfTreeMap.LeafColorMapping>
<TreeMap:SfTreeMap.Levels>
<TreeMap:TreeMapFlatLevel
ShowLabels="True" />
</TreeMap:SfTreeMap.Levels>
</TreeMap:SfTreeMap>
However, when I want to display a heirarchical level, with the following XAML:
<TreeMap:SfTreeMap
ItemsSource="{Binding Depts}"
WeightValuePath="TreeMapWeight"
LeafLabelPath="TreeMapLeafLabel">
<TreeMap:SfTreeMap.LeafColorMapping>
<TreeMap:DesaturationColorMapping />
</TreeMap:SfTreeMap.LeafColorMapping>
<TreeMap:SfTreeMap.Levels>
<TreeMap:TreeMapHierarchicalLevel
ChildPath="TreeMapSubDepts"
ShowLabels="True" />
</TreeMap:SfTreeMap.Levels>
</TreeMap:SfTreeMap>
I get the following exception:
ArgumentException: Specified Path () does not match with any fields in given DataSource
at Syncfusion.UI.Xaml.TreeMap.TreeMapEngine.GetValue(String field, Object o)
at Syncfusion.UI.Xaml.TreeMap.TreeMapEngine.GetTreeMapItems(String valueData, String colorData, String labelData, String headerData)
at Syncfusion.UI.Xaml.TreeMap.SfTreeMap.GenerateTreeMapItems()
at Syncfusion.UI.Xaml.TreeMap.SfTreeMap.SfTreeMap_SizeChanged(Object sender, SizeChangedEventArgs e)
InnerException: None
I have verified at runtime that the ViewModel's object graph is correctly built and populated. What do I have to do to get heirarchical levels to show up in the TreeMap?