0

Whenever an item is selected in my TreeView, it automatically does a vertical scroll and positions in the middle. How to prevent this automatic scrolling in UWP TreeView?

I found this StackOverflow answer on preventing horizontal scrolling in WFP but I can't find any

<EventSetter Event="RequestBringIntoView" Handler="TreeViewItem_RequestBringIntoView"/>

event in UWP.

Badhan Sen
  • 617
  • 1
  • 7
  • 18
  • Could you please be more specific about the scrolling behavior that you mentioned? What scrolled, the content of the TreeView or the nodelist of the TreeView? – Roy Li - MSFT Jul 04 '22 at 05:55
  • nodelist of TreeView as after scrolling I selected a node in Treeview. Then it automatically moves to the middle of the TreeView. – Badhan Sen Jul 04 '22 at 13:57
  • I made a simple TreeView sample with many nodes in UWP to test. But I can't reproduce the behavior that you mentioned. When I select the node that is not in the middle, the nodelist will not move. Could you please share the code snippet that could reproduce the behavior? – Roy Li - MSFT Jul 05 '22 at 02:33
  • Actually, I made a mistake that it happen only make text bigger on windows 11 is enable. Then a flickering occurs and the scroll move a little bit up. – Badhan Sen Jul 05 '22 at 10:16
  • I also made a demo Treeview application and it's work fine in my end also. – Badhan Sen Jul 05 '22 at 10:17
  • Do you mean you changed the text size in the Settings? I tried the set the text size as the biggest and test again. but it still does not scroll automatically. – Roy Li - MSFT Jul 06 '22 at 02:10
  • Hi @RoyLi-MSFT I think I have found my actual problem. In ScrollViewer I have TreeView and also some other items. When going down and selecting a specific item then the automatic scroll happens. It will not go to the middle but a scroll happens. – Badhan Sen Jul 07 '22 at 13:03
  • I think I have the similar issue as this issue suggests. Link: https://github.com/microsoft/microsoft-ui-xaml/issues/597 – Badhan Sen Jul 07 '22 at 13:05
  • In this thread, a ScrollViewer Jumps to Top-most but in my end ScrollViewer jump. And it is visible. – Badhan Sen Jul 07 '22 at 13:06
  • Have you tried DuncWatts's workaround in the link you posted? Setting `IsTabStop="true"`? – Roy Li - MSFT Jul 08 '22 at 01:40

0 Answers0