Questions tagged [hierarchicaldatatemplate]

A `HierarchicalDataTemplate` is a subclass of `DataTemplate` that allows you to bind directly to a hierarchy of objects

A HierarchicalDataTemplate is a subclass of DataTemplate that allows you to bind directly to a hierarchy of objects. This provides a powerful means to bind a hierchy of objects to wpf controls that deal with such data, such as TreeViews and Menus.

305 questions
4
votes
1 answer

Bind to DataContext of TreeView from HierachicalDataTemplate

I have a TreeView which contains items populated by a HierarchicalDataTemplate. I am trying to get to a property in the TreeView's DataContext from inside the HierarchicalDataTemplate. Can someone help? Here is what I tried in the…
KrisTrip
  • 4,943
  • 12
  • 55
  • 74
4
votes
1 answer

How do I sort a WPF TreeView using the HierarchicalDataTemplate for EntityCollection objects?

My Webpage is an Entity Framework entity. These are bound to a WPF TreeView. I want to order all the Webpages shown in the TreeView on the Sort property. Code EDMX Its Subordinates property returns a collection of zero or more…
Zack Peterson
  • 56,055
  • 78
  • 209
  • 280
4
votes
3 answers

WPF TreeView-How to refresh tree after adding/removing node?

I refer to this article: WPF TreeView HierarchicalDataTemplate - binding to object with multiple child collections and modify the tree structure like: Root |__Group |_Entry |_Source In Entry.cs: public class Entry { public…
user610801
  • 67
  • 1
  • 1
  • 6
4
votes
1 answer
4
votes
2 answers

TreeView HierarchicalDataTemplate does not apply ItemContainerStyle

I try do display hierarchical data with a TreeView and I would like to set different DataTemplates for my different Children types. But the thing is, that my style does not get applied. Maybe its a very simple mistake but i really do not find…
4
votes
2 answers

Bind a Wpf HierarchicalDataTemplate ItemsSource to a CollectionViewSource in a dictionary?

I'm trying to display a Wpf Treeview with items sorted by a CollectionViewSource. Currently, everything is working except sorting using this code in my resource dictionary:
4
votes
1 answer

WPF Treeview HierarchicalDataTemplate Drag and drop

I have a treeview in wpf that is built using the xaml below. It is a well structured data source, and I am having a lot of trouble dragging and dropping. I have tried several methods, all to no avail. Can anyone tell me what the standard procedure…
Dested
  • 6,294
  • 12
  • 51
  • 73
4
votes
1 answer

How do I reuse a HierarchicalDataTemplate?

I have two identical HierarchicalDataTemplates. The only difference is the DataType of the templates.
mjcopple
  • 1,580
  • 2
  • 13
  • 19
4
votes
1 answer

WPF Object send itself as MultiBinding path

Basically what I need to know is how to send the source of an HierarchicalDataTemplate into a binding, this is what I have:
Carlo
  • 25,602
  • 32
  • 128
  • 176
4
votes
1 answer

ControlTemplate for second level of TreeView

I'm trying to create a TreeView which has two levels but I'm getting nowhere. I have an ItemTemplateSelector (which works - selecting either of the first two templates listed below), but I can't get the children to populate using a DataTemplate.…
Echilon
  • 10,064
  • 33
  • 131
  • 217
3
votes
2 answers

HierarchicalDataTemplate doesn’t show any children - why not?

I am trying the absolute simplest use of HierarchicalDataTemplate to bind nested data to a WPF TreeView. For some reason, the children of my tree are not visible:                                                 Here is the entire XAML:
Roman Starkov
  • 59,298
  • 38
  • 251
  • 324
3
votes
1 answer

treeview item validation

I'm trying to validate items inside a treeview. The main idea is that a user selects an object from the tree and that loads its details which can be edited. That's all working fine as I've got INotifyPropertyChanged hooked up but... my model has…
hyp
  • 1,370
  • 1
  • 9
  • 21
3
votes
1 answer

How to change HierarchicalDataTemplate?

How can I change HierarchicalDataTemplate by DataTrigger in my TreeView?