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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:24:38+00:00 2026-05-12T10:24:38+00:00

Background: I have an application where I want to be able to capture keyboard

  • 0

Background: I have an application where I want to be able to capture keyboard events. On the main screen, the user clicks a Start button. During the game, the Start button goes away and a Reset button is shown (Visibility changes on the two controls). These are the only two standard controls involve as all else is non-focusable user controls.

Problem: When the user clicks Start (thereby giving it focus), then it hides and Reset appears, the Reset button automatically seems to get the focus. This isn’t awful since key press events are still raised, but the focus causes a big problem. If the user presses Space, then the button interprets it as a Click event.

If I add a handler for KeyUp and KeyDown to the button itself and set the event to Handled, it will swallow the event if I hold down the space and let go, but not if I just tap it.

Question: How can I prevent Space from activating a button, while still being able to respond to the Space in my app?

  • 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-05-12T10:24:38+00:00Added an answer on May 12, 2026 at 10:24 am

    Consider creating a simple custom control, or using one that you can set IsHitTestVisible="True" on. Then, place it somewhere within the same Grid, and hook up to its key events and other input events you’d like to capture.

    To make sure that focus goes to your “invisible” control, you can call (yourControlsNameHere).Focus() once the Start button is pressed.

    You could work with the visual/tab order to either put your hidden, focus-capturing control before or after the Reset button. I don’t think your users would mind the idea that tabbing around the app could have them put the focus on the non-focusable user controls that their input correlates to.

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

Sidebar

Related Questions

I have developed the application in which i want to set the background color
I have written a application which runs in the background. I want to write
I have an application without a save button; saving happens automatically in the background.
I have a DataGrid control in a WPF application. I want to be able
Background: I have started Android recently. I want to make an application for Android
Background I want to be able to parse Javascript source in a Delphi Application.
I want to build application which needs to be able to capture video from
Background: I have an application with athletes, each of these athletes (Athlete model) can
Background: I have an application that, when installed, generates a random identifier (AppId). When
Some background: we have a windows application (c#) that locate in the system try.

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.