19.04.2013 Views

IntegralUI TreeListView User Guide - Lidor Systems

IntegralUI TreeListView User Guide - Lidor Systems

IntegralUI TreeListView User Guide - Lidor Systems

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

[VB]<br />

Me.treeListView1.Nodes.Clear();<br />

[C#]<br />

this.treeListView1.Nodes.Clear();<br />

How to add existing node collection<br />

If you want some predefined set of nodes, and you want this set as a whole to be added to the<br />

<strong>TreeListView</strong> control, you can use AddRange method:<br />

[VB]<br />

Imports <strong>Lidor</strong><strong>Systems</strong>.<strong>IntegralUI</strong>.Lists<br />

. . .<br />

Dim nodes As <strong>TreeListView</strong>Node() = New Node(6) {}<br />

For i As Integer = 0 To 6<br />

nodes(i) = New <strong>TreeListView</strong>Node("Item " & i.ToString())<br />

Next<br />

Me.treeListView1.Nodes.AddRange(nodes)<br />

[C#]<br />

using <strong>Lidor</strong><strong>Systems</strong>.<strong>IntegralUI</strong>.Lists;<br />

. . .<br />

<strong>TreeListView</strong>Node[] nodes = new <strong>TreeListView</strong>Node[7];<br />

for (int i = 0; i < 7; i++)<br />

nodes[i] = new <strong>TreeListView</strong>Node("Item " + i.ToString());<br />

this.treeListView1.Nodes.AddRange(nodes);<br />

How to edit the node text<br />

During runtime you can allow to users to edit the node text and change it. This can be done by<br />

setting the LabelEdit property to True. After that whenever the user clicks on the node and<br />

releases the mouse button, a TextBox will appear in which the node text can be edited.<br />

If you want to start editing process in other way, you need to use BeginEdit and EndEdit<br />

methods. In the following example we will show how to programmatically start editing process:<br />

[VB]<br />

If Me.<strong>TreeListView</strong>1.SelectedNode IsNot Nothing Then<br />

Me.<strong>TreeListView</strong>1.LabelEdit = True<br />

Me.<strong>TreeListView</strong>1.SelectedNode.BeginEdit()<br />

End If<br />

[C#]<br />

if (this.treeListView1.SelectedNode != null)<br />

{<br />

this.treeListView1.LabelEdit = true;<br />

this.treeListView1.SelectedNode.BeginEdit();<br />

40

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!