Friday, 15 March 2013

c# - How to bind a collection of nested dictionaries to a TreeView? -


My Nested Dictionary is a collection of objects. The following structure appears in each dictionary:

  [Title] - & gt; String [Child] - & gt; Dictionary & lt; String, Object & gt; | | [Title] - & gt; String [Child] - & gt; Dictionary & lt; String, Object & gt; | | ....  

And so on, the last element of each 'path' which does not have only [title] entry (no child).

With the Xaml below, the complete collection is shown with each node, but I do not get any exception, in which there are no node leaves.

It seems, how can I say this, as if I am seeing a level ahead of bounding the current level but my tree view shows the element before the entire collection. What's wrong

  & lt; TreeView ItemsSource = "{Binding Item}" & gt; & Lt; TreeView.ItemTemplate & gt; & Lt; Hierarchical data items source = "{binding [hair]}" & gt; & Lt; StackPanel Orientation = "Horizontal" & gt; & Lt; Image width = "12" height = "14" source = "{static resource items_ico}" stretch = "uniform" /> & Lt; Label content = "{binding [name]}" tooltip = "{binding [name]}" tooltip service. Placement = "Top" /> & Lt; / StackPanel & gt; & Lt; / HierarchicalDataTemplate & gt; & Lt; /TreeView.ItemTemplate> & Lt; / TreeView & gt;  

Edit: Sorry. The first post was incomplete (slipped on the return key)


No comments:

Post a Comment