Hey,
I would like to implement Infragistic's XamDataTree but I'm having a problem with binding a NodeLayout to a dictionary.
One of my Items in the Hierarchy holds a property of a dictionary, which I'd like to bind the DataTree's Node Layout too. Actually, to be more specific, I only need to bind the NodeLayout to the dictionary's values list.
However, when I try doing that with this markup
<Infragistics:NodeLayout Key="Fields" TargetTypeName="FieldMetaData" DisplayMemberPath="Values.FieldName"/>
I get this error in my debug output when trying to expand its parent node, to see this exact node layout -
"Unable to cast object of type 'System.Collection.Generic.KeyValuePair`2[FieldMetaData]' to type 'System.String'.
I tried many other tricks and variation that unfortunately didn't work. Also, apparently TargetTypeName does nothing in this case since I guess it doesn't recognize the values as "FieldMetaData" type, so only "Keys" actually works.
So I wonder if XamDataTree even supports dictionaries, or if there's anyway to make it work because all I actually need is to bind to the list of Dictionary values.
In Microsoft's regular TreeView It worked, so it will be a bit disappointing if I couldn't make this work with XamDataTree.
Thanks!
Dror.
Hello Dror,
Here is the support ticket number: CAS-64403-MK72NY we have created on your behalf. I am going to link it to development issue: 73766 so that you get automatically update when a Feature Release containing the fix is available for download. You can get the new version from our website’s “My IG”, “My Keys & Downloads” tags: https://www.infragistics.com/Membership/Default.aspx?panel=Downloads#Downloads
You can also monitor the support ticket’s progress through the “My Support Activity” tag: https://www.infragistics.com/Membership/MySupport.aspx
Sincerely,
Petar, MCTS
Developer Support Engineer
Infragistics
www.infragistics.com/support
I'll see if I could find a way to manage in the mean time.
So was this resolved? Do the XamDataTrees' nodelayouts support a Dictionary?
Hi,
Excuse me for not updating this thread sooner. This issue has been fixed and included into the 2011 May Service Release and has also been verified as such by DrorCohen in an internal developer support ticket.
Nice Thanks, So how do I do this for a Dictionary<string,string>. What would be the syntax?
I tried this
<ig:NodeLayout Key="MapLayout" TargetTypeName="Dictionary<string,string>" DisplayMemberPath="Key"/>
but it didn't work. Would really appreciate your help here. Thanks.
Hi jlmehta,
I am attaching the sample from the bug that was fixed last year. You can observe the code and see how to use the Dictionary as ItemsSource for XamDataTree. If you have any questions, please feel free to ask!
Regards,
Nikola.
This sample for dictionary binding to xamDataTree is not available anymore , can you please attach any sample code or file for same .
Thank you in advance
Regards
Nkaur