UWP RepeatButton MouseEvent

217 views Asked by At

I have tried to access the PreviewMouseLeftButtonUp as suggested here

But it is not available in UWP.

For now I just have:

btnLower.KeyUp += BtnLower_KeyUp; // keyboard
btnLower.PointerReleased += BtnLower_PointerReleased; // seems only touch input

The KeyUp seems to work for keyboard input as expected. The PointerReleased does not work with stylus/pen input or mouse input. So how do I respond to the event when the RepeatButton stops to fire the click event?

I use the click event to just increase or decrease an int value and want to store that value when the change (increase/decrease) is done. And I would like it to respond to pen/touch/mouse and keyboard input.

edit for @Sasha

enter image description here

1

There are 1 answers

2
Filip Skakun On

You could throttle your code that stores the value to make it only do that when no updates have occurred for a while. That way you won't have to hack around the input stack.

You could try using a custom VisualStateManager in the button template that will trigger an event when the visual state changes from pressed to neutral, but that seems a bit hacky and unnecessary.