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.

8856 questions
29
votes
1 answer

How to get Windows native look for the .NET TreeView?

When using the TreeView component in .NET, I get the look of the left tree. How can I get the look of the right tree (Windows Native Look) for my .NET TreeView? What I especially want to get is the "triangle" node handles and the blue "bubble"…
user356178
28
votes
8 answers

TreeNode Selected BackColor while TreeView not focused

Is there an easy way to have a selected TreeNode retain its SystemColors.Highlight BackColor while the TreeView doesn't have focus? Because even with HideSelection set to false, the selected BackColor is near impossible to see. Selected TreeNode…
Spark
  • 927
  • 1
  • 7
  • 24
27
votes
1 answer

Having HierarchicalDataTemplates in a TreeView

With regards to a question I posted earlier on (WPF: Correctly storing an object in a TreeViewItem) Is it possible to have nested HierarchicalDataTemplates in a TreeView? Take the following example: Code: public class Artist { private…
Andreas Grech
  • 98,643
  • 98
  • 284
  • 354
27
votes
3 answers

TreeView Remove CheckBox by some Nodes

I want remove CheckBoxes where the Node.Type is 5 or 6. I use this code: private void TvOne_DrawNode(object sender, DrawTreeNodeEventArgs e) { int type = (e.Node as Node).typ; if (type == 5 || type == 6) { Color backColor,…
Werewolve
  • 2,238
  • 5
  • 22
  • 36
27
votes
6 answers

WPF TreeView - How to scroll so expanded branch is visible

When I expand items in my treeview so that scrolling is necessary, a scrollbar appears. However, it doesn't scroll down for the newly expanded branch of items - they get cropped by the bottom of the control. So as I continue expanding items at the…
Jared
  • 649
  • 2
  • 8
  • 15
27
votes
6 answers

Enable scroll for WPF Treeview

Can anybody help me out with how to enable a treeview to scroll? There must be a simple way but I can't make it work in my code. After multiple failed tries, I currently have something like this:
Ronald
  • 1,624
  • 5
  • 19
  • 38
26
votes
3 answers

Right click select on .Net TreeNode

I am trying to show a popup menu on my treeview when users right click - allowing them to choose context sensitive actions to apply against the selected node. At the moment the user has to left click node and then right click to choose. Is it…
Martin
  • 36,545
  • 20
  • 97
  • 129
26
votes
5 answers

How to make WPF TreeView style as WinForms TreeView?

WPF default TreeView is very good, I still want it have lines joint each its child element, like Windows Forms TreeView. I have searched on internet and have some example, but it did not designed well enough. How can I achieve it with WPF?
Tuyen Pham
  • 7,251
  • 12
  • 51
  • 97
26
votes
6 answers

How to filter a wpf treeview hierarchy using an ICollectionView?

I have a hypothetical tree view that contains this data: RootNode Leaf vein SecondRoot seeds flowers I am trying to filter the nodes in order to show only the nodes that contain a certain text. Say if I specify "L", the tree will be…
David
  • 8,635
  • 5
  • 57
  • 64
26
votes
4 answers

Is there a method for searching for TreeNode.Text field in TreeView.Nodes collection?

Like this: TreeNode[] treeNodes = treeView.Nodes.Find(searchString, true); but I want it to search in the text field instead of the name field.
Romz
  • 1,317
  • 4
  • 29
  • 60
25
votes
6 answers

Allow multi-select in a .NET TreeView

I'm stuck in .NET 2.0 Windows Forms. It doesn't look like the ability to select multiple nodes exists in the standard TreeView control. I'm trying to do this for a context menu selection. So check boxes aren't an acceptable UI paradigm here. What's…
Darcy Casselman
  • 2,494
  • 3
  • 24
  • 26
25
votes
9 answers

WinForms TreeView - how to manually "highlight" node (like it was clicked)

I would need to know how to let the programatically selected node make graphically in the state "selected" like the user clicked on it. SelectedNode only makes this one internally selected. Thank you very much!
Petr
  • 7,073
  • 14
  • 42
  • 53
24
votes
4 answers

wpf treeview binding

Is there any simple tutorial for beginners about treeview binding in WPF? What should we write in ItemsSource, DataType, ItemTemplate attributes if there's one List of items? IList items = new…
pojo
  • 287
  • 1
  • 3
  • 4
24
votes
7 answers

populate treeview from a list of path

I'm trying to populate a treeview from a list of folder path, for…
Eric
23
votes
5 answers

Scroll selected TreeView node into view

I have a System.Windows.Forms.TreeView docked inside a panel. I am setting a node selected programmatically. What method or property would I use to have the treeview scroll the selected into view?
Brad
  • 17,634
  • 36
  • 80
  • 101