Skip to main content

TreeView

A TreeView object is an object that has static and dynamic uses.

For dynamic type use, you need a rest connection.

Then it should fill in the relevant fields from the object properties. (Value Expression, Display Expression, Hierarchy Type, Children Key...)

For static type use, items should be added from the Items section. Each item's properties include Children Items. From here, the sub-items of that item are added. Thus, a broken hierarchical list structure is obtained.

In TreeView, the elements of the list are displayed directly on the form. If desired, the sub-items are displayed by clicking on the items.

ID PARENTID VALUE
1 Null Text
2 Null Text2
3 1 Text3

If we consider the table above as Treeview;

Text
Text3
Text2

It means that there is a breakdown in the form of.

*The parentids of the main breakdowns must be null.

*ID and ParentID data must be of int type.

Below are sample project images for using Treeview.

On the server side, items can also be added to the TreeView object:

TreeView treeView = new TreeView();

first item
TreeViewItem item1 = new TreeViewItem();
item1. Key = "Item1";
item1. Text = "Item1Text";

first item in child i
TreeViewItem item1child1 = new TreeViewItem();
item1child1. Key = "Item1Child1";
item1child1. Text = "Item1Child1Text";

item1. Children.Add(item1child1);

second item
TreeViewItem item2 = new TreeViewItem();
item2. Key = "Item2";
item2. Text = "Item2Text";

second item in child i
TreeViewItem item2child1 = new TreeViewItem();
item2child1. Key = "Item2Child1";
item2child1. Text = "Item2Child1Text";

item2. Children.Add(item2child1);

treeView.TreeItems.Add(item1);
treeView.TreeItems.Add(item2);