Directional Navigation Focus with TreeView and TreeViewItem
Hello!
I am working on building out a TreeView control that is nested within a Grid that contains other items. When using directional navigation with a controller, I am able to move focus from the outer Grid items to the TreeViewItems, but once focus is on a TreeViewItem, it will not leave the TreeView and return to the outer Grid items. It directionally navigates multiple TreeViewItems correctly, but will not move focus outside of itself.
Given the below structure of code, I would expect directional navigation to work as follows: When focus starts on the Control, moving directionally downward once with the controller joystick would place focus on the top TreeViewItem (which is what happens), and then moving directionally upward once would place focus back on the Control.
I've tried explicitly setting "KeyboardNavigation.DirectionalNavigation=Continue" on the TreeView, but that didn't work. My TreeViewItems are essentially using the same structure as the Sample TreeView Selector found in the Gallery sample (https://github.com/Noesis/Tutorials/blo ... urces.xaml).
Is this expected TreeView behavior? Is there a property that needs to be set on the TreeView to allow directional navigation to move in and out of its bounds?
I am working on building out a TreeView control that is nested within a Grid that contains other items. When using directional navigation with a controller, I am able to move focus from the outer Grid items to the TreeViewItems, but once focus is on a TreeViewItem, it will not leave the TreeView and return to the outer Grid items. It directionally navigates multiple TreeViewItems correctly, but will not move focus outside of itself.
Given the below structure of code, I would expect directional navigation to work as follows: When focus starts on the Control, moving directionally downward once with the controller joystick would place focus on the top TreeViewItem (which is what happens), and then moving directionally upward once would place focus back on the Control.
Code: Select all
<Grid>
<Control/>
<TreeView>
<TreeViewItem/>
<TreeViewItem/>
</TreeView>
</Grid>
Is this expected TreeView behavior? Is there a property that needs to be set on the TreeView to allow directional navigation to move in and out of its bounds?
Re: Directional Navigation Focus with TreeView and TreeViewItem
Looking into this a bit more, I think it may be the result of the ScrollViewer within the TreeView capturing directional navigation events - is there a way to escape the ScrollViewer when scroll is at the top?
-
-
sfernandez
Site Admin
- Posts: 2793
- Joined:
Re: Directional Navigation Focus with TreeView and TreeViewItem
Hi,
I've been investigating a bit and it seems the problem is in the TreeViewItem code, because it is handling the KeyDown event and not allowing the KeyboardNavigation to come into play.
Could you please create a ticket in our bugtracker and we will fix that for the next release?
Thanks.
I've been investigating a bit and it seems the problem is in the TreeViewItem code, because it is handling the KeyDown event and not allowing the KeyboardNavigation to come into play.
Could you please create a ticket in our bugtracker and we will fix that for the next release?
Thanks.
Re: Directional Navigation Focus with TreeView and TreeViewItem
I will - thank you for looking into the issue!
Who is online
Users browsing this forum: Semrush [Bot] and 3 guests