Lets say you have 3 classes. Class A and Class B derive from class C:Class C { public int c; }Class B: C { public int b; }
Class A: C { public int a; }If I create a collection populated with class A & B objects, the node binder doesn't seem capable of treating them like Class C objects:// somewhere in the code behind... building a collection that is to be assigned to the XamTreemap.ItemsSource propertyIList<C> mylist = new List<C>();mylist.Add(new B());mylist->Add(new A());// in xaml:<ig:NodeBinder TargetTypeName="C" /* other irrelevant property assignments */ ></ig:NodeBinder>If i do roughly the above, the control doesn't show anything. If I change the code behind such that I populate mylist with only objects of type Class C, it works just fine:
// changing my code behind to this causes the infragistics control to populate appropriatelyIList<C> mylist = new List<C>();mylist.Add(new C());mylist->Add(new C());Is there a way to get the control to treat objects in a list as there base class? Or even an interface might work. The list of objects has other uses than just populating the control. I'd rather not have the code go through the pain staking process of recreating an entire list when that could be thousands of objects that are far more complicated than the ones I've shown here when all I really need is access to the base class properties to properly populate the tree map.
Hi Ryan,
I am attaching a sample where I have tried to reproduce your scenario:
1. I am having the two classes (A and B), both derive from C;
2. I am binding the XamTreemap instance to a collection that is similar to the one form the code snippet above;
3, I am instantiating the XamTreemap in XAML and adding a NodeBinder with the relevant properties;
If the attached solution does not match your scenario, please let me know so I can provide further assistance.
Thanks,
Stefana
Thanks Stefana for putting together the sample project. It does look like it matches my scenario. When I run the code "as-is", I get the message:
"There are not any valid treemap nodes. Please check the items source and data binders.".
If I change your code such that the list you populated gets populated only with ClassC objects, then it works as expected. So, yes, the project you've attached seems to demonstrate the problem I am seeing. At least locally on my machine.
Again, the only code change I made was this:
void MainPage_Loaded(object sender, RoutedEventArgs e) { List<ClassC> mylist = new List<ClassC>(); mylist.Add(new ClassC() { c = 11 }); mylist.Add(new ClassC() { c = 12 }); mylist.Add(new ClassC() { c = 13 }); mylist.Add(new ClassC() { c = 21 }); mylist.Add(new ClassC() { c = 22 }); mylist.Add(new ClassC() { c = 23 }); this.myTreemap.ItemsSource = mylist; }
The attached sample works fine, all nodes are displayed and no such message is displayed.
May be there are some other differences between the attached sample scenario and yours - XAML definition or something else. It would be nice if you provide some more detailed code snippets, so that I can isolate the actual problem.
Thanks again,
Well, if that attached project works for you then likely it's an environment issue because it doesn't work for me unless I modify it. The main difference that I can think of is that I'm using the evaluation version of the dll's. Both my project and the sample code you attached are using silverlight 5. I'm using the same versions of the dll's. Everything else mostly seems to be the same.
You are correct!
It looks like an issue in the RTM version that has already been fixed in the latest SR.
I hope this will really solve the problem.
I am waiting for your feedback!
Ok. So.. just to be clear. Are those changes available now or in a future release?
Thanks Stefana.
Hi,
The fix is available in the latest public service release for our 12.1 Silverlight controls - 2206.
In order to download it you could go to your Infragistics account, click on the according product key, and you could find a link to this service release under the "Service Releases" tab.
Please feel free to let us know if you have any other questions with this matter.
Thanks