Hi, Guru
It worked. Thanks a lot.
--Shuyang He
>Hi Shuyang,
>
>After having further investigated this code, it appears to be a shortcoming in our TreeViewAdv control. I have notified the development team in this regard, and will update you as soon as I have more information available.
>
>For now, you could use the PopupMenu control instead of the .Net ContextMenu as a workaround.
>
>'' set the TreeViewAdv as the target control of the PopupMenu
>Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
> Me.PopupMenusManager1.SetXPContextMenu(Me.TreeViewAdv1, Me.PopupMenu1)
> End Sub
>
>'' Before displaying the menu, check if its the first node
> Private Sub PopupMenu1_BeforePopup(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.CancelMouseEventArgs) Handles PopupMenu1.BeforePopup
> Dim root As TreeNodeAdv = Me.TreeViewAdv1.Root.Nodes(0)
> Dim clickPoint As Point = Me.TreeViewAdv1.PointToClient(Control.MousePosition)
> Dim clickNode As TreeNodeAdv = Me.TreeViewAdv1.PointToNode(clickPoint)
>
> If (root Is clickNode) Then
> '' display popupmenu
> Else
> e.Cancel = True
> End If
> End Sub
>
>'' Insert a new node on the first BarItem being clicked
> Private Sub BarItem1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BarItem1.Click
> Dim root As TreeNodeAdv = Me.TreeViewAdv1.Root.Nodes.Item(0)
> Dim newNode As TreeNodeAdv = New TreeNodeAdv("TestCat")
> root.Nodes.Insert(0, newNode)
> End Sub
>
>I have modified your
earlier sample accordingly and have attached it here. Let me know if this works for you. We appreciate your feedback, and thanks for choosing Syncfusion products.
>
>Regards,
>Guru Patwal
>Syncfusion, Inc.