Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7775077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:32:20+00:00 2026-06-01T17:32:20+00:00

Below is what I tried to assign a shortcut for a menu item. When

  • 0

Below is what I tried to assign a shortcut for a menu item. When I click on menu item it works good but shortcut does not work. Any idea?

<Window.CommandBindings>
    <CommandBinding Command="ApplicationCommands.Save" Executed="MyCommand" />
</Window.CommandBindings>

<Window.InputBindings>
    <KeyBinding Key="S" Modifiers="Control" Command="ApplicationCommands.Save"/>
</Window.InputBindings>

<MenuItem Header="Save" Name="MainMenu_File_Save" Command="ApplicationCommands.Save">
    <MenuItem.Icon>
        <Image Height="16" Width="16" Source="/NewGUI_WPF;component/Images/saveHS.png" />
    </MenuItem.Icon>
</MenuItem>

private void MyCommand(object sender, ExecutedRoutedEventArgs e) {...}  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T17:32:22+00:00Added an answer on June 1, 2026 at 5:32 pm
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Windows;
    using System.Windows.Controls;
    using System.Windows.Data;
    using System.Windows.Documents;
    using System.Windows.Input;
    using System.Windows.Media;
    using System.Windows.Media.Imaging;
    using System.Windows.Navigation;
    using System.Windows.Shapes;
    
    namespace test
    {
        /// <summary>
        /// Interaction logic for MainWindow.xaml
        /// </summary>
        public partial class MainWindow : Window
        {
            public MainWindow()
            {
                InitializeComponent();
            }
    
            private void MyCommand(object sender, ExecutedRoutedEventArgs e)
            {
                MessageBox.Show("Test");
            }
        }
    }
    
    <Window x:Class="test.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            Title="MainWindow" Height="350" Width="525">
      <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Save" Executed="MyCommand" />
      </Window.CommandBindings>
    
      <Window.InputBindings>
        <KeyBinding Key="S" Modifiers="Control" Command="ApplicationCommands.Save"/>
      </Window.InputBindings>
    
      <Grid>
        <Menu IsMainMenu="True">
         <MenuItem Header="_File">
          <MenuItem Header="Save" Name="MainMenu_File_Save" Command="ApplicationCommands.Save" />
         </MenuItem>
       </Menu>
      </Grid>
    </Window>
    

    That works for me. Does it work for you ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried below but not getting any result back Not sure if i'm
I've tried the below script but I am getting an error: dim cn, rs
I want to open an xlsx file, I have tried the below code,but neither
I tried command like below. But can't see server time. psexec \\SERVER_NAME -i -u
If I compile the code below, I get an Error C2064: term does not
In the code below I tried in two ways to access the parent version
I tried the below code to check whether my mobile is connected to a
I want to send data through URL.I've tried the below code: Intent browserIntent =
I want to style mail body. I have tried the below methods to style
I need to echo entire content of included file. I have tried the below:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.