Hi,I want create and binding xamTreeMap at code.In XAML page I created xamTreeMap:<ig:XamTreemap x:Name="XamTreeMap_1" LayoutType="Squarified" LayoutOrientation="Horizontal" />
In code I do this:
List
<Prekess> pr1 = new List<Prekess>();pr1.Add(new Prekess { name = "Preke 1", kaina = 10000 });pr1.Add(new Prekess { name = "Preke 2", kaina = 1000 });pr1.Add(new Prekess { name = "Preke 3", kaina = 20000 });pr1.Add(new Prekess { name = "Preke 4", kaina = 7000 });pr1.Add(new Prekess { name = "Preke 5", kaina = 15000 });
List<Prekess> pr2 = new List<Prekess>();pr1.Add(new Prekess { name = "Preke 6", kaina = 10000 });pr1.Add(new Prekess { name = "Preke 7", kaina = 1000 });pr1.Add(new Prekess { name = "Preke 8", kaina = 20000 });pr1.Add(new Prekess { name = "Preke 9", kaina = 7000 });pr1.Add(new Prekess { name = "Preke 10", kaina = 15000 });
List<Pelnass> p = new List<Pelnass>();p.Add(new Pelnass { id = "Vienas", Prekess = pr1 });p.Add(new Pelnass { id = "Du", Prekess = pr2 });
XamTreeMap_1.ItemsSource = p;
XamTreeMap_1.NodeBinders.Add(
new Infragistics.Controls.Charts.NodeBinder{TargetTypeName = "Pelnass",TextPath = "id",ItemsSourcePath = "Prekess"});
new Infragistics.Controls.Charts.NodeBinder{TargetTypeName = "Prekes",TextPath = "kaina",ItemsSourcePath = "name"});
But it not working.I see this message:There are not anyvalid treemap nodes. Please check the items source and the data binders.
Can anyone help me?
Thanks,
I have attached a sample project which contains your code made to work. The main mistakes were that you have not specified a ValuePath to the Prekess NodeBinder. There was a typo in the TargetTypeName of that binder - Prekes instead of Prekess. Another mistake was that you add data just to the first list of Prekess