0
votes

I have a UWP app in which I have several buttons. Once the app starts to run, I set the focus in my code to the first button using a code like this:

firstButton.Focus(FocusState.Programmatic);

After this point, what I am interested in is that once the user use the mouse wheel, the UWP app automatically scroll to second, third, fourth, ... button(exactly like when we use tab key on keyboard to move between buttons).

However, when I use mouse wheel, nothing happens in the app.

I should also say that in firstbutton xaml, I use pointerwheelchanged event listener to change the focus to second button. However, this event handler does not work with mouse wheel UNTIL I MOVE THE MOUSE CURSOR INSIDE THE AREA OF FIRST BUTTON. What I am interested in is that this scrolling using mouse wheel becomes automatic exactly like the tab key of keyboard.

Any suggestions?

1

1 Answers

0
votes

Place the event on the container control (like the Grid). If it's a control that already processes the event, use the AddHandler method with handledEventsToo set to true.