locked
when enter key is pressed, a button on windows apps is pushed. how to disable that? RRS feed

  • Question

  • when enter key is pressed, a button on windows apps is pushed. how to disable that?
    the button should be pressed by only mouse click
    Tuesday, January 13, 2015 12:59 AM

Answers

  • Do you mean Windows or Windows Phone? You posted in the Windows Phone forum, but your text suggests Windows.

    Why do you want to do this? Not supporting keyboard is a major accessibility bug.

    If you have another way to trigger the button's behaviour and want to handle enter to do something else then you can handle the key event.

    Tuesday, January 13, 2015 1:35 AM

All replies

  • Do you mean Windows or Windows Phone? You posted in the Windows Phone forum, but your text suggests Windows.

    Why do you want to do this? Not supporting keyboard is a major accessibility bug.

    If you have another way to trigger the button's behaviour and want to handle enter to do something else then you can handle the key event.

    Tuesday, January 13, 2015 1:35 AM
  • You could listen to CoreWindow KeyDown or KeyUp event then

    mark args.Handled=true if you have detected it is Enter Key.

    [Eidt] As Rob points out, do not override default behavior unless there is a compelling usage for ENTER key.

    • Edited by hereafter Tuesday, January 13, 2015 3:46 AM
    Tuesday, January 13, 2015 3:26 AM
  • You could listen to CoreWindow KeyDown or KeyUp event then

    mark args.Handled=true if you have detected it is Enter Key.

    Hi Hereafter,

    Please read my entire response. You repeated the end of my post, but the beginning is VERY important. It is essential to understand the scenario and not to break keyboard accessibility by naively blocking enter.

    --Rob

    Tuesday, January 13, 2015 3:36 AM