Menu item action handler : Menu « Windows Presentation Foundation « VB.Net

Menu item action handler

Menu item action handler
<Window x:Class="WpfApplication1.Window1"
  Title="FlowDocReader Load/Save Sample" Width="640" Height="480">
      <RowDefinition Height="22"/>


    <Menu Grid.Row="0">
        <MenuItem Click="LoadFile">
        <MenuItem Click="SaveFile">
          <MenuItem.Header>Save As...</MenuItem.Header>
        <MenuItem Click="Clear">
          <MenuItem.Header>Clear Content</MenuItem.Header>
        <MenuItem Click="Exit">
    <FlowDocumentReader Name="FlowDocRdr" Grid.Row="1"/>

Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Shapes
Imports System.Windows.Forms
Imports System.IO
Imports System.Windows.Markup

Namespace WpfApplication1

  Public Partial Class Window1
    Inherits Window

    Public Sub New()
    End Sub

    Private Sub LoadFile(sender As [Object], args As RoutedEventArgs)
    End Sub

    Private Sub SaveFile(sender As [Object], args As RoutedEventArgs)
    End Sub

    Private Sub Clear(sender As [Object], args As RoutedEventArgs)
      FlowDocRdr.Document = Nothing
    End Sub
    Private Sub [Exit](sender As [Object], args As RoutedEventArgs)
    End Sub
  End Class
End Namespace


Related examples in the same category

1.Mixed MenusMixed Menus
2.Sidebar MenuSidebar Menu
3.Put a Menu and toolbar on the top of a DockPanelPut a Menu and toolbar on the top of a DockPanel
4.Nesting content inside MenuItem.HeaderNesting content inside MenuItem.Header
5.Multiple command targetsMultiple command targets
6.Commands with a menu and text boxCommands with a menu and text box
7.Set Access key for Menu with underscoreSet Access key for Menu with underscore
8.Menu and MenuItemMenu and MenuItem
9.MenuItem Commands And EventsMenuItem Commands And Events
10.Display a Context Menu with OpacityDisplay a Context Menu with Opacity
11.MenuBar and ToolBarMenuBar and ToolBar
12.Add Menu to NavigationWindow ContentAdd Menu to NavigationWindow Content