wpf - Using ItemsControl on a multi-leveled TreeView -


My co-worker threatened to put me on The Daily WTF today because of my property I wrote that Treeview with a 3-tiered ItemsControl

I bear you footprint.

  ObservableCollection & LT; KeyValuePair & LT; String, ObservableCollection & LT; KeyValuePair & LT; String, ObservableCollection & LT; MyType & gt; & Gt; & Gt; & Gt; & Gt ;;  

My goal was to create an ItemsControl that would use the key as the header, and value as the item source for 3 levels:

 < Code> & lt; Style x: key = "filtertrusty" target type = "item control" & gt; & Lt; Setter property = "item template" & gt; & Lt; Setter.Value & gt; & Lt; DataTemplate & gt; & Lt; Control: Tree View ITemand = "True" & gt; & Lt; Control: TreeViewItem.Header & gt; & Lt; Control toolkit: triviumcombback content = "{binding key}" /> & Lt; / Control: TreeViewItem.Header & gt; & Lt; ItemsControl ItemSource = "{Binding Values}" & gt; & Lt; ItemsControl.ItemTemplate & gt; & Lt; DataTemplate & gt; & Lt; Control: TreeViewItem & gt; & Lt; Control: TreeViewItem.Header & gt; & Lt; Control toolkit: triviumcombback content = "{binding key}" /> & Lt; / Control: TreeViewItem.Header & gt; & Lt; ControlsToolkit: TreeViewItemCheckBox IsChecked = "{Enable Binding}" content = "{Binding FilterTypeText}" /> & Lt; / Control: TreeViewItem & gt; & Lt; / DataTemplate & gt; & Lt; /ItemsControl.ItemTemplate> & Lt; / ItemsControl> & Lt; / Control: TreeViewItem & gt; & Lt; / DataTemplate & gt; & Lt; /Setter.Value> & Lt; / Setter & gt; & Lt; / Style & gt;  

Can anyone save me from the clutches of TheDailyWTF? What is a cleaner way of doing this? If we can figure out how to make the number of dynamic levels in a way bonus

uh, maybe I'm dumb here, but ever since you want a tree wiege. Why not use the preview? You will also have to use a HierarchicalDataTemplate instead of a Vanilla DataTemplate: The content of the HDT gets the header and ItemsSource is used to make baby nodes. That is why it will also have to take care of the number of dynamic levels.

TreeView is built in WPF and available in Silverlight as part of the SDK.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -