We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Heirarchical Levels do not work

Thread ID:

Created:

Updated:

Platform:

Replies:

116892 Jun 25,2014 05:28 PM Jun 26,2014 08:06 AM WinRT 1
loading
Tags: SfTreeMap
Daniel Thompson
Asked On June 25, 2014 05:28 PM

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?

Dhanasekar R [Syncfusion]
Replied On June 26, 2014 08:06 AM

Hi Daniel, 

Thanks for your interest in syncfusion products. 

The following mistakes you have done in your sample

1) All the Properties should be Dependency Property or CLR Property.

2) ColorValuePath is a mandatory property. (You can give value of WeightValuePath).

Please find the attached sample for reference

Please let us know if any further clarifications.

Regards,

Dhanasekar R


Attachment: TreeMapSample_2f4e0100.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;