Questions tagged [treeview]

TreeView control is used to display hierarchical information.

A tree view (control) displays a hierarchy of nodes, where the user can expand and collapse these nodes while navigating through the control. Often a tree view will provide the user the ability to view or edit additional information relating to the node selected.

Tree views are often used to present hierarchical data, such as an XML document or files and folders structure.

9439 questions
261
votes
21 answers

Data binding to SelectedItem in a WPF Treeview

How can I retrieve the item that is selected in a WPF-treeview? I want to do this in XAML, because I want to bind it. You might think that it is SelectedItem but apparently that does not exist is readonly and therefore unusable. This is what I want…
Natrium
  • 30,772
  • 17
  • 59
  • 73
118
votes
5 answers

Is there any publicly accessible JSON data source to test with real world data?

I'm working on a JavaScript dynamically loaded tree view user control. I'd like to test it with real world data. Does anybody know any public service with an API that provides access to hierarchical data in JSON format?
ILya
  • 2,670
  • 4
  • 27
  • 40
109
votes
11 answers

Select TreeView Node on right click before displaying ContextMenu

I would like to select a WPF TreeView Node on right click, right before the ContextMenu displayed. For WinForms I could use code like this Find node clicked under context menu, what are the WPF alternatives?
alex2k8
  • 42,496
  • 57
  • 170
  • 221
76
votes
10 answers

Find node clicked under context menu

How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. I can't use the TreeViews' SelectedNode property because the node is only been right-clicked…
Sam
  • 5,416
  • 7
  • 47
  • 49
65
votes
4 answers

WPF TreeView HierarchicalDataTemplate - binding to object with multiple child collections

I am trying to get a TreeView to bind my collection so that all groups show nested groups and each group will show entry. How can I use the HierarchicalDataTemplate so that the TreeView will process both SubGroups and Entries collection? Groups show…
longday
  • 4,075
  • 4
  • 28
  • 35
61
votes
16 answers

How to programmatically select an item in a WPF TreeView?

How is it possible to programmatically select an item in a WPF TreeView? The ItemsControl model seems to prevent it.
Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139
59
votes
3 answers

WPF TreeView: How to style selected items with rounded corners like in Explorer

The selected item in a WPF TreeView has a dark blue background with "sharp" corners. That looks a bit dated today: I would like to change the background to look like in Explorer of Windows 7 (with/without focus): What I tried so far does not…
Helge Klein
  • 8,829
  • 8
  • 51
  • 71
58
votes
1 answer

Weird scroll behavior in latest Blink-included browsers (like Chrome, Opera)

Recently I've been working on building a tree-view component library for Angular, as ngx-tree. Problem Soon after I figured out how to implement a virtual-scroll feature for this library for performance with large data set, and got it to run…
e-cloud
  • 4,331
  • 1
  • 23
  • 37
58
votes
14 answers

C# Winforms bold treeview node doesn't show whole text

I'm using the following code to make my treenodes bold: Font font = new Font(tvQuestionSequence.Font, FontStyle.Bold); foreach (QuestionnaireBuilder_Category cat in categories) { TreeNode node = new TreeNode(); node.Text =…
Martijn
  • 24,441
  • 60
  • 174
  • 261
54
votes
4 answers

Customizing the TreeView to allow multi select

The built-in WPF TreeView control does not allow for multi selection, like a ListBox does. How can I customize the TreeView to allow for multi selection without rewriting it.
Dylan
  • 2,392
  • 6
  • 26
  • 34
54
votes
12 answers

Is there way to expand all folders in Eclipse project view and search results?

I'm spending a lot of time manually expanding deeply-nested folders in tree views like the Project Explorer and the File Search result tree. Is there a keyboard shortcut or menu command to expand all folders?
meva
  • 862
  • 2
  • 8
  • 11
53
votes
5 answers

AutoExpand treeview in WPF

Is there a way to automatically expand all nodes from a treeview in WPF? I searched and didn't even find an expand function in the treeview property. Thanks
David Brunelle
  • 6,528
  • 11
  • 64
  • 104
48
votes
2 answers

Vue JS : right click event directive

I know these vue event handlers: @click : mouse left-click @dblclick : mouse double click What could be the handler/directive to detect a right-click? Need to implement a custom Context menu in Vue Tree view.
Praveen Kamath
  • 959
  • 2
  • 10
  • 18
46
votes
9 answers

WPF TreeView: Where is the ExpandAll() method

How can I expand all TreeView nodes in WPF? In WinForms there was a ExpandAll() method which does this.
mehdi
43
votes
3 answers

How to avoid winforms treeview icon changes when item selected

I'm experimenting with a treeview in a little C#/Winforms application. I have programatically assigned an ImageList to the treeview, and all nodes show their icons just fine, but when I click a node, its icon changes (to the very first image in the…
S.C. Madsen
  • 5,100
  • 5
  • 32
  • 50
1
2 3
99 100