<Window x:Class="MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Menus"
        Title="Menús" Height="350" Width="525" >
  <Window.Resources>
    <CommandBinding x:Key="EnlaceGuardar"
                    Command="{x:Static local:OrdenesPersonalizadas.Guardar}"
                    Executed="ExecutedGuardar"
                    CanExecute="CanExecuteGuardar" />
    <ContextMenu x:Key="menuContextualEditar">
      <MenuItem Name="mcEditarCortar" Command="Cut" />
      <MenuItem Name="mcEditarCopiar" Command="Copy" />
      <MenuItem Name="mcEditarPegar" Command="Paste" />
    </ContextMenu>
  </Window.Resources>
  <Window.CommandBindings>
    <CommandBinding Command="{x:Static local:MainWindow.RCAbrir}"
                    Executed="ExecutedRCAbrir"
                    CanExecute="CanExecuteRCAbrir" />
    <CommandBinding Command="ApplicationCommands.Close"
                    Executed="ArchivoSalir_Click" />
  </Window.CommandBindings>
  <Window.InputBindings>
    <KeyBinding Key="A"
                Modifiers="Control" 
                Command="{x:Static local:MainWindow.RCAbrir}" />
    <MouseBinding Gesture="Control+MiddleClick"
                  Command="Close"/>
    <KeyBinding Key="S"
                Modifiers="Control" 
                Command="ApplicationCommands.Close"  />
  </Window.InputBindings>
  <Grid>
    <Grid.RowDefinitions>
      <RowDefinition Height="Auto" />
      <RowDefinition />
    </Grid.RowDefinitions>
    <Menu Grid.Row="0" Name="BarraDeMenus" VerticalAlignment="Top" >
      <MenuItem Name="menuArchivo" Header="_Archivo">
        <MenuItem Name="ArchivoAbrir" Header="A_brir..." Command="{x:Static local:MainWindow.RCAbrir}" InputGestureText="Ctrl+A">
          <MenuItem.Icon>
            <Image Source="/Menus;component/Imagenes/openHS.png" />
          </MenuItem.Icon>
        </MenuItem>
        <MenuItem Name="ArchivoGuardar"
                  Command="{x:Static local:OrdenesPersonalizadas.Guardar}"
                  CommandParameter="{Binding Path=Destino}">
          <MenuItem.Icon>
            <Image Source="/Menus;component/Imagenes/saveHS.png" />
          </MenuItem.Icon>
        </MenuItem>
        <Separator />
        <MenuItem Name="ArchivoSalir" Header="_Salir" InputGestureText="Ctrl+S" Command="Close"  />
      </MenuItem>
      <MenuItem Name="menuEditar" Header="_Editar">
        <MenuItem Name="EditarCortar" Command="Cut" />
        <MenuItem Name="EditarCopiar" Command="Copy" />
        <MenuItem Name="EditarPegar" Command="Paste" />
      </MenuItem>
      <MenuItem Name="menuAyuda" Header="Ay_uda">
        <MenuItem Name="AyudaAcercaDe" Header="_Acerca de..." />
      </MenuItem>
    </Menu>
    <TextBox ContextMenu="{StaticResource menuContextualEditar}" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="98,92,0,0" Name="textBox1" VerticalAlignment="Top" Width="300" GotFocus="textBox1_GotFocus">
      <TextBox.CommandBindings>
        <StaticResource ResourceKey="EnlaceGuardar" />
      </TextBox.CommandBindings>
      <TextBox.InputBindings>
        <KeyBinding Key="G" Modifiers="Control" 
                    Command="{x:Static local:OrdenesPersonalizadas.Guardar}"
                    CommandParameter="{Binding Path=Destino}" />
      </TextBox.InputBindings>
    </TextBox>
    <TextBox ContextMenu="{StaticResource menuContextualEditar}" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="98,165,0,0" Name="textBox2" VerticalAlignment="Top" Width="300" GotFocus="textBox2_GotFocus">
      <TextBox.CommandBindings>
        <StaticResource ResourceKey="EnlaceGuardar" />
      </TextBox.CommandBindings>
      <TextBox.InputBindings>
        <KeyBinding Key="G" Modifiers="Control" 
                    Command="{x:Static local:OrdenesPersonalizadas.Guardar}"
                    CommandParameter="{Binding Path=Destino}" />
      </TextBox.InputBindings>
    </TextBox>
  </Grid>
</Window>
