Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
545
Dynamic control events using Addhandler on ExplorerBar doest seem to work
posted

I am creating a ExplorerBar at runtime and adding a group and item to it.  I also add an event handler as shown.  When I execute the application, the event doest get fired.  How do I get this to work?   Due to the design of the application, I need to do this dynamically.

Private Sub AddNavPanel()

'Create explorer bar
   Dim ctlLeftNavSubPanel As New UltraWinExplorerBar.UltraExplorerBar
   ctlLeftNavSubPanel.Style = UltraExplorerBarStyle.VisualStudio2005Toolbox
    ctlLeftNavSubPanel.GroupSettings.Style = Infragistics.Win.UltraWinExplorerBar.GroupStyle.SmallImagesWithText

'Add a group to it
Dim ctlGroupItemsList As New UltraWinExplorerBar.UltraExplorerBarGroup
ctlGroupItemsList.Text = "Sub Group 1"
ctlGroupItemsList.Key = "Sub Group 1"
ctlLeftNavSubPanel.Groups.Add(ctlGroupItemsList)

'Add items to the group
Dim ctlGroupItem As New UltraWinExplorerBar.UltraExplorerBarItem
ctlGroupItem.Text = "Item 1"
ctlGroupItem.Key = "Item 1"
ctlGroupItemsList.Items.Add(ctlGroupItem)

'Add event handler
 AddHandler ctlLeftNavSubPanel.ItemClick, AddressOf Me.ctlLeftNavSubPanel_ItemClick

 End sub

 

 

Private Sub ctlLeftNavSubPanel_ItemClick(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinExplorerBar.ItemEventArgs)
        Dim s As String
        s = e.Item.Text
    End Sub