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
7
votes
3 answers

How to reference a generic type in the DataType attribute of a HierarchicalDataTemplate?

I have a class of MyClass and want to set it as the DataType for a HierarchicalDataTemplate. What is the syntax for this in XAML? (I know how to set namespaces, I need just the syntax for
Dabblernl
  • 15,831
  • 18
  • 96
  • 148
6
votes
2 answers

Using HierarcicalDataTemplates in conjunction with TreeViewItem control templates

I am having some difficulty figuring out how to template the following TreeView item layout: I have several items, SearchList, which contains a collection of Search, which contains a collection of DataSet (sort of, but that is beside the point). …
CodeWarrior
  • 7,388
  • 7
  • 51
  • 78
6
votes
2 answers

How can I use HierarchicalDataTemplate to display XML Elements and Attributes?

I'd like to display arbitrary XML in a TreeView, with expanding and collapsing nodes, showing both the element name and the set of attributes and their values. I think I can do this with HierarchicalDataTemplate . I've seen the hints to use…
Cheeso
  • 189,189
  • 101
  • 473
  • 713
6
votes
2 answers

Setting up WPF treeview triggers to show different images on expand

I have a wpf tree view that displays nodes of various types with corresponding images such as folder images. Initially, the tree and its nodes with corresponding images display as expected. However when a node is expanded, the expectation is that…
Dave Clemmer
  • 3,741
  • 12
  • 49
  • 72
6
votes
1 answer

What's an idiomatic XAML TreeView with CollectionViewGroup groupings?

I have a TreeView that looks like this:
Mathieu Guindon
  • 69,817
  • 8
  • 107
  • 235
6
votes
2 answers

WPF Binding parent property in HierarchicalDataTemplate

I have a WPF TreeView with 2 levels of data and 2 HierarchicalDataTemplate to format each level. From the HierarchicalDataTemplate at the second level, I need to bind a property in the class of the first level. I have tried in this way, but it…
lamarmora
  • 1,116
  • 4
  • 16
  • 32
5
votes
3 answers

Implement WPF treeview with different Parent Nodes a well as different child nodes?

I want to implememt a tree view with has the following structure..... [RootNode] <---- Root of tree --[ParentNode P1] <---- Object of ModelClass P1 ----[ChildNode C1] <----- Object of ModelClass C1 (have children of different type as…
Ankesh
  • 4,847
  • 4
  • 38
  • 76
5
votes
3 answers

How can I have multiple types of children in a single Silverlight TreeView node?

Short Vesion: I have to display a hierarchy (TreeView) of items of different types, and am not sure how to do this cleanly in Silverlight. In WPF, it's straightforward to define templates (HierarchicalDataTemplate) based on types, but this feature…
5
votes
1 answer

Recursive HierarchicalDataTemplate (WPF)

I'm not sure how to approach this: I want a TreeView that will display some simple data from a hierarchical data structure. As a basic example (In XML, cause it's easy to type):
Toji
  • 33,927
  • 22
  • 105
  • 115
5
votes
3 answers

How to make TreeView node selected/expanded when ItemsSource = custom object collection?

I have a TreeView intended to operate on two levels. For his I have two HierarchicalDataTemplate and two custom types. The ItemsSource is linked to a ObservableCollection and everything works fine. I just can't figure how to make a node selected or…
mandarin
  • 1,316
  • 1
  • 15
  • 27
5
votes
2 answers

Using the Treeview HierarchicalDataTemplate.Triggers to change folder icon

I'm pretty fresh to WPF and this is the closest I have come to achieving what I set out to do after reviewing many of the previously asked questions posted here. The XAML code:
5
votes
2 answers

WPF HierarchicalDataTemplate TreeView is not Clickable

I have a TreeView with a HierarchicalDataTemplate. The items are filled correctly but I can't click on the TreeView items. (I can't select one, so that is marked blue). I can click in front of the TreeViewItem and then the selected is marked blue.…
user2025830
  • 872
  • 2
  • 17
  • 37
5
votes
2 answers

WPF TreeView hierarchical binding.

just starting with wpf. I need to bind the object (Hierarchical) Folder public class Folder { public Folder() { this.Name = string.Empty; this.Modules = new ObservableCollection(); this.Folders = new…
5
votes
1 answer

Embed DataGrid into WPF Treeview nodes

I need to display Hierarchy in the treeview. But Details should be displayed in the datagrid. How do I have to write my template to achieve this? I misunderstand smth in templates for now.
Artiom
  • 7,694
  • 3
  • 38
  • 45
4
votes
1 answer

Change TreeViewItem Template when IsSelected and two types using in TreeView

In my TreeView I use two differnt classes for binding. For example, I have a Group what can have ChildGroup and can have Items. Example code of this classes: using System.Collections.Generic; using System.Collections.ObjectModel; namespace…
Victor Chekalin
  • 676
  • 1
  • 8
  • 15
1
2
3
20 21