dxTreeView
Namespace: Wisej.Web.Ext.DevExtreme
Assembly: Wisej.Web.Ext.DevExtreme (4.1.0.0)
The TreeView widget is a tree-like representation of textual data.
- C#
- VB.NET
public class dxTreeView : dxBase
Public Class dxTreeView
Inherits dxBase
Constructors
dxTreeView()
Constructs a new instance of the dxTreeView class.
Example:
The following example creates a tree view from a flat list of items and shows the node clicked by the user.
var treeView = new dxTreeView();
treeView.Options.items = new[]
{
new { id = 1, parentId = 0, text = "Documents" },
new { id = 2, parentId = 1, text = "Invoices" },
new { id = 3, parentId = 1, text = "Contracts" }
};
treeView.Options.dataStructure = "plain";
treeView.Instance.onItemClick += new WidgetEventHandler((s, e) =>
{
AlertBox.Show($"Clicked: {e.Data.itemData.text}");
});
treeView.Dock = DockStyle.Left;
this.Controls.Add(treeView);
dxTreeView(options)
Constructs a new instance of the dxTreeView class.
| Name | Type | Description |
|---|---|---|
| options | Object | Initial set of options. |
Example:
The following example creates a tree view with check boxes and a search box, then expands all the nodes from server code.
var treeView = new dxTreeView(new
{
dataSource = categories,
dataStructure = "plain",
keyExpr = "id",
parentIdExpr = "parentId",
displayExpr = "name",
showCheckBoxesMode = "normal",
searchEnabled = true
});
treeView.Dock = DockStyle.Left;
this.Controls.Add(treeView);
treeView.Instance.expandAll();