echapin
Topic Author
Posts: 7
Joined: 14 Sep 2022, 21:28

TreeView with VirtualizingPanel Scroll Behavior

24 Oct 2022, 21:55

Hello!

I am using a TreeView element with a configuration similar to the "Properties" TreeView used in the Noesis Inspector code (included below):
<TreeView x:Name="Properties" Grid.Row="2"
                                      ItemsSource="{Binding FilteredItems, ElementName=FilteredProperties}"
                                      ItemTemplate="{StaticResource Template.LiveProperties}"
                                      HorizontalContentAlignment="Stretch"
                                      ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                                      ScrollViewer.CanContentScroll="True"
                                      VirtualizingPanel.IsVirtualizing="True"
                                      VirtualizingPanel.VirtualizationMode="Recycling"
                                      VirtualizingPanel.ScrollUnit="Pixel"
                                      Background="{StaticResource Brush.Section.ContentBg}">
I'm noticing an interesting behavior with directional navigation and the scroll behavior, where directionally navigating down or up between TreeViewItems at the bottom or top of the viewport does not scroll down or up to show the full item, but rather about 2/3 of the item, even if it is the last or first item in the list. This results in needing to explicitly scroll up or down to view the rest of the list. You can see this behavior in the Inspector itself - when the Properties list for an element is displayed, if you directionally navigate from the second-to-last item to the last item while the last item is not in view, the bottom of it is cut off, requiring you to move the scroll bar to see the end of the list.

My guess is that this has something to do with the scroll unit being set to pixel, but I wanted to see if this was the expected behavior, and if so, what the best way to modify the ScrollViewer might be to ensure that directionally navigating calculates the vertical offset so that the full item or beginning/end of list was displayed.
 
User avatar
sfernandez
Site Admin
Posts: 3363
Joined: 22 Dec 2011, 19:20

Re: TreeView with VirtualizingPanel Scroll Behavior

26 Oct 2022, 11:59

Hi, I was able to reproduce it in our Inspector, and it is not the expected behavior, could you please report it in our bugtracker?
It must be something related to the calculations done in the RequestBringIntoView event. We'll take a look and fix it as soon as possible.
 
echapin
Topic Author
Posts: 7
Joined: 14 Sep 2022, 21:28

Re: TreeView with VirtualizingPanel Scroll Behavior

26 Oct 2022, 17:41

Reported here: #2447. Thanks for looking into it!

Who is online

Users browsing this forum: No registered users and 12 guests