Quantcast
Viewing all articles
Browse latest Browse all 18858

WPF Treeview

Hello,

I have some problems with the treeview of WPF (vb2012).

On the mainwindow i have a treeview called "tvMain".

In the code i add the sub item to it. 

    Public Sub MakeTreeview()

        Try
            Dim trvItem(20) As TreeViewItem

            For x As Int32 = 0 To 20
                trvItem(x) = New TreeViewItem
            Next

            trvItem(0).Header = "- AA"
            tvMain.Items.Add(trvItem(0))

            trvItem(6).Header = "- BB"
            tvMain.Items.Add(trvItem(6))

            trvItem(2).Header = "- CC"
            trvItem(6).Items.Add(trvItem(2))

            trvItem(3).Header = "- DD"
            trvItem(6).Items.Add(trvItem(3))

            trvItem(4).Header = "- EE"
            trvItem(3).Items.Add(trvItem(4))

            trvItem(5).Header = "- FF"
            tvMain.Items.Add(trvItem(5))

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

Whem i click "- CC" on the treeview i like to have:

"- CC" and the index 2.

Please can someone help me.

Thanks


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>