Guest User

Untitled

a guest
Jun 21st, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. <ListBox DataContext="{StaticResource customers}"
  2. ItemsSource="{Binding}">
  3.  
  4. ItemsSource="{Binding Path=TheImages, Source={StaticResource ImageFactoryDS}}"
  5.  
  6. <StackPanel DataContext="{StaticResource Data}">
  7. <ListBox ItemsSource="{Binding Customers}"/>
  8. <ListBox ItemsSource="{Binding Orders}"/>
  9. </StackPanel>
  10.  
  11. <ListBox ItemsSource="{Binding Source={StaticResource customers}}"/>
  12.  
  13. Class Root
  14. {
  15. public string Name;
  16. public List<ChildRoot> childRoots = new List<ChildRoot>();
  17. }
  18.  
  19. Class ChildRoot
  20. {
  21. public string childName;
  22. }
  23.  
  24. Root r = new Root()
  25. r.Name = "ROOT1";
  26.  
  27. ChildRoot c1 = new ChildRoot()
  28. c1.childName = "Child1";
  29. r.childRoots.Add(c1);
  30.  
  31. c1 = new ChildRoot()
  32. c1.childName = "Child2";
  33. r.childRoots.Add(c1);
  34.  
  35. c1 = new ChildRoot()
  36. c1.childName = "Child3";
  37. r.childRoots.Add(c1);
  38.  
  39. treeView.DataContext = r;
  40.  
  41. <TreeViewItem ItemsSource="{Binding Path=childRoots}" Header="{Binding Path=Name}">
  42. <HierarchicalDataTemplate DataType="{x:Type local:Root}" ItemsSource="{Binding Path=childRoots}">
  43.  
  44. List<Root> lstRoots = new List<Root>();
  45. lstRoots.Add(r);
  46.  
  47. <HierarchicalDataTemplate DataType="{x:Type local:Root}" ItemsSource="{Binding Path=childRoots}">
Add Comment
Please, Sign In to add comment