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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

}<br />

<strong>TreeListView</strong>SubItem subItem = null;<br />

for (int j = 0; j < this.treeListView1.Columns.Count; j++)<br />

{<br />

subItem = new <strong>TreeListView</strong>SubItem();<br />

}<br />

switch (this.treeListView1.Columns[j].ContentType)<br />

{<br />

default:<br />

subItem.Text = "Item " + sufix + j.ToString();<br />

break;<br />

}<br />

parentNode.SubItems.Add(subItem);<br />

private void CreateSubNodes(<strong>TreeListView</strong>Node parentNode, int level, string sufix)<br />

{<br />

// In this example only two levels in hierarchy are allowed<br />

if (level == 2)<br />

return;<br />

else<br />

{<br />

// Create child nodes for specified node<br />

<strong>TreeListView</strong>Node node = null;<br />

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

{<br />

node = new <strong>TreeListView</strong>Node("Node " + sufix + i.ToString());<br />

nodeIndex++;<br />

}<br />

}<br />

}<br />

// Create subitems for this node<br />

CreateSubItems(node, sufix + i.ToString());<br />

// Create child nodes for this node<br />

CreateSubNodes(node, level + 1, sufix + i.ToString());<br />

parentNode.Nodes.Add(node);<br />

The above code will create two columns with several nodes and two subitems in each node. All<br />

data in column will be labels.<br />

How to show custom images in column<br />

By changing a little bit above code sample, we will set the second column to show images. The<br />

changes are marked in Red:<br />

[VB]<br />

Private Sub InitList(ByVal sender As Object, ByVal e As EventArgs)<br />

' Create three columns with header and footer description<br />

Dim column As <strong>TreeListView</strong>Column = Nothing<br />

For j As Integer = 0 To 1<br />

column = New <strong>TreeListView</strong>Column("Header " & j.ToString(), "Footer " &<br />

j.ToString())<br />

28

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

Saved successfully!

Ooh no, something went wrong!