Sumel007
Topic Author
Posts: 30
Joined: 19 Mar 2020, 10:50

ScrollViewer keyboard navigation.

08 Mar 2023, 14:00

Hi!

I have a general WPF question that I have trouble solving on my own.

I have a ScrollViewer, which contains a StackPanel, which contains elements arranged in something resembling rows. Each row has some focusable elements (buttons, sliders etc.), sometimes one, sometimes two. I can navigate via keyboard between these elements properly when they are in view. However once I reach the end (ie. I want to scroll down to the next element that is invisible beyond the scrollviewer, or scroll up) the focus escapes to some outside elements.
This doesn't happen always - in another similar case (different xaml, but similar arrangement of items, though inside the StackPanel there are also some ItemsControls which might be responsible for this logic?) if I scroll down I can focus on elements beyond view and they properly catch focus and are moved into view of the ScrollViewer (though the focus is still lost when trying to scroll up).


My question is: is there some simple way to allow the elements that are not rendered, but are within the ScrollViewer to catch focus in the same way as if they were visible on the screen? I want the user to not have to focus on the ScrollViewer (it has focusable set to false now), but instead for the ScrollViewer to just seemlessly scroll up/down when trying to focus on the next element after reaching the ScrollViewer's edge.
I was thinking about trying to catch the PreviewKeyDown event and scrolling up/down the scrollviewer manually, but the rows might have different height, so I'm hoping there's some simpler way that I haven't thought of.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer keyboard navigation.

09 Mar 2023, 13:54

Is this happening using directional navigation (left/right, up/down)?
Because I think it is related to this bug: https://www.noesisengine.com/bugs/view.php?id=2242
We have to fix it in the next version, as there is no easy workaround.
 
Sumel007
Topic Author
Posts: 30
Joined: 19 Mar 2020, 10:50

Re: ScrollViewer keyboard navigation.

10 Mar 2023, 08:19

It happens both with directional navigation and tab navigation. Thanks for linking the other thread, it seems to be the same/very similar problem. I didn't test it out in WPF, so I thought it was working like that by design and I was missing some parameter or something.

Do you have any estimate when we could expect a fix (even in a beta version)? This feature is going to be very important for us.
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer keyboard navigation.

15 Mar 2023, 11:08

We will fix this during the following weeks after GDC. We will provide you a patch as soon as we solve it.
 
sergey.sitnikov.nt
Posts: 4
Joined: 16 Oct 2020, 13:58

Re: ScrollViewer keyboard navigation.

21 Mar 2023, 13:19

I have also experienced that issue so it would be great to get a patch for it. Sergio, would it be possible please to point in the direction of where the issue might be and whether there is any way to override that behaviour?
 
User avatar
sfernandez
Site Admin
Posts: 2983
Joined: 22 Dec 2011, 19:20

Re: ScrollViewer keyboard navigation.

27 Mar 2023, 16:36

Hi Sergey, it is related to the focus management implemented by KeyboardNavigation. Unfortunately there is no way to override that behavior as I mentioned before.

Who is online

Users browsing this forum: Google [Bot], vinick and 65 guests