Form

GPALTreeView

Everything on Settings Every Control Takes applies here too. GPAL.TreeView builds one. WithCheckBoxes puts a checkbox on every node, WithShowLines draws the lines joining nodes and WithShowPlusMinus the expand and collapse boxes. AddNode adds a node and hands back a GPALTreeNode, which has AddNode of its own for children, a Text, a Checked state, an Enabled property that greys one node, and Select to make it the current one. AfterSelect is the primary event. GPAL.TreeViewFor() is the shorthand.

Examples

GPAL Fluent: High-level fluent C# API

//Nodes added through AddNode are GPAL's own, which is what gives them Enabled and the rest. A raw TreeNode added to the underlying control has none of that.

GPALTreeView workflows = (GPALTreeView)GPAL.TreeView

.WithCheckBoxes(true)

.WithShowLines(true)

.WithShowPlusMinus(true)

.WithCallback<TreeViewEventHandler>(NodeChosen).ForEvent(ControlEventType.AfterSelect)

.WithName("workflows");


GPALTreeNode daily = workflows.AddNode("Daily");

daily.AddChild("Download invoices");

daily.AddChild("Post to ledger");


GPALTreeNode locked = workflows.AddNode("Locked workflow");

locked.Enabled = false; // greyed, and it cannot become the selected node

💬 Ask GPAL