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 7866513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T00:25:20+00:00 2026-06-03T00:25:20+00:00

I tried DelegateCommand approach, it executes properly, but my key gestures do not work:

  • 0

I tried DelegateCommand approach, it executes properly, but my key gestures do not work:

public DelegateCommand StageCommand { get; private set; }

...
StageCommand = new DelegateCommand(StageExecuted);
...

private void StageExecuted(object action)
{
    System.Console.WriteLine("yay!");
}

And XAML for my Context Menu:

        <ContextMenu.InputBindings>
            <KeyBinding Command="{Binding PlacementTarget.Tag.StageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}"
                        Gesture="Enter" />
        </ContextMenu.InputBindings>

        <MenuItem Header="Stage" Command="{Binding PlacementTarget.Tag.StageCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}">
        </MenuItem>

All this executes properly, but I am missing the key gesture, it does not even display it:

enter image description here

This is how I use the context menu:

<DataGrid 
          ContextMenu="{DynamicResource TestContextMenu}"
          Tag="{Binding}">

Update:

If I press Enter while the context menu is open, it executes. How can I make it so that it executes as long as the control that has the context menu attached to it has focus? And also, it still does not display the gesture key.

  • 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-03T00:25:23+00:00Added an answer on June 3, 2026 at 12:25 am

    From MSDN for MenuItem.InputGestureText:

    This property does not associate the input gesture with the menu item; it simply adds text to the menu item. The application must handle the user’s input to carry out the action.

    Basically, because that is purely a text field for displaying an input gesture to users in the default MenuItem Control Template there is no association between it and some command you’ve decided to wire-up with a KeyBinding.

    You could handle this through a binding, or a StaticResource, or maybe thru an attached property/behavior which searches the KeyBindings and assigns input gestures to any child which uses the matching command.

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

Sidebar

Related Questions

Tried a bunch of things but I can't get it to work consistently amid
Tried many ways based on other questions asked here but could not get a
Tried to use the following code, but it doesn't work properly: // download the
tried to calculate sun lat and long using PyEphem but not matching with ephemeris
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
tried /[^fF\d+\s+]?[AF]?[\s+]?(\d+(\.\d{1,2})?-\d+(\.\d{1,2})?)/ want to match: AF11-16 AF 11-16 11-16 16.5-100 but do not match:
tried using the following but it's not the solution controller: var list = new
Tried everything. This UPDATE don't work. No error or something - it just not
I tried so hard but I just cannot get a simple Richfaces AjaxStatusTag inserted
tried to find the answer by googling and in MSDN but with no luck.

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.