2
Vote

MenuBarItem where is Click method?

description

Hi,
 
Thanks for your Menu control, its great, but where is Click method for this element?
 
Thanks.

comments

mjda wrote Aug 12, 2010 at 1:09 PM

Private Sub MenuItem_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
    System.Windows.Browser.HtmlPage.Window.Alert("you pressed: " + TryCast(sender, MenuItem).MenuText)
End Sub
...

Private Sub loadMenu(ByVal host As Canvas)
    Dim it1 As New MenuBarItem()
    it1.MenuText = "File"

    Dim f1 As New MenuItem()
    f1.MenuText = "new item"
    it1.items.Add(f1)
    AddHandler f1.Click, AddressOf MenuItem_Click

    Dim f2 As New MenuItem()
    f2.MenuText = "new item 2"
    it1.items.Add(f2)
    AddHandler f2.Click, AddressOf MenuItem_Click

    Dim f3 As New MenuItem()
    f3.MenuText = "very"
    it1.items.Add(f3)
    AddHandler f3.Click, AddressOf MenuItem_Click

    Dim it2 As New MenuBarItem()
    it2.MenuText = "Edit"
    Dim a1 As New MenuItem()
    a1.MenuText = "new item"
    it2.items.Add(a1)
    AddHandler a1.Click, AddressOf MenuItem_Click

    Dim it3 As New MenuBarItem()
    it3.MenuText = "Help"
    Dim b1 As New MenuItem()
    b1.MenuText = "this"
    it3.items.Add(b1)
    AddHandler b1.Click, AddressOf MenuItem_Click

    Dim b2 As New MenuItem()
    b2.MenuText = "that"
    it3.items.Add(b2)
    AddHandler b2.Click, AddressOf MenuItem_Click

    Dim bar As New MenuBar()
    bar.items.Add(it1)
    bar.items.Add(it2)
    bar.items.Add(it3)

    host.Children.Add(bar)

End Sub

wrote Feb 14, 2013 at 2:46 AM