locked
Highlighting a button on programatic keypress RRS feed

  • Question

  • Hi there,

    I've got a grid of buttons that mimics a number keypad in a XAML Windows store app.

    When you use the physical keypad I'm trapping the keys on Grid.KeyDown and firing the button click events using ButtonAutomationPeer (maybe there's a simpler way than that?)

    What I'd like to see is the corresponding button highlighted as if it has been clicked with a mouse (ie the pressed visual state animation), but just invoking the button's action doesn't achieve this.

    Anyone any idea how to do this?

    Thanks,


    Thanks, R

    Tuesday, November 5, 2013 12:39 PM

Answers

  • There isn't any built-in way to do this. You could try shifting the Button's visual states yourself, but at the risk of getting out of sync from the actual button.

    --Rob

    • Marked as answer by Reece Williams Wednesday, November 6, 2013 8:26 AM
    Tuesday, November 5, 2013 9:32 PM
    Moderator

All replies

  • There isn't any built-in way to do this. You could try shifting the Button's visual states yourself, but at the risk of getting out of sync from the actual button.

    --Rob

    • Marked as answer by Reece Williams Wednesday, November 6, 2013 8:26 AM
    Tuesday, November 5, 2013 9:32 PM
    Moderator
  • Thanks Rob, that did it.

    I did have to put in a small delay between states to see the change, but it looks good now.

    R.


    Thanks, R

    Wednesday, November 6, 2013 8:27 AM