Reacting to user scrolling a ListView #20891
-
Hello everyone! In my android app I have a page with essentially two elements: An Expander at the top and a ListView for the rest of the screen. The Expander contains some filter settings for the resulting elements in the ListView. Now I want the following behaviour: The expander should collapse as soon as the user scrolls the ListView up or down. I saw the I also tried to get the ScrollViewer element of the ListView through the VisualTreeHelper and react to the ViewChanged event. Problem here is, that the ViewChanged event also occurs when the Expander expands, which results in my Expander to immediately collpapse again if I try to expand it manually. Am I missing the obvious solution here? Or does anyone have another idea? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Indeed, it seems there is a particular problem on native-android, where changing the size of the ListView would cause it to scroll up a bit each time. And, that seem to cause this problem for you. I will create an issue to track this: #21039 That said, there is a simple workaround for you, you can use the
This property will be true, for all the ViewChanged events raised during the manually scrolling (including quick flicking), except the last one. |
Beta Was this translation helpful? Give feedback.
Indeed, it seems there is a particular problem on native-android, where changing the size of the ListView would cause it to scroll up a bit each time. And, that seem to cause this problem for you. I will create an issue to track this: #21039
That said, there is a simple workaround for you, you can use the
ScrollViewerViewChangedEventArgs.IsIntermediate
from the ScrollViewer::ViewChanged event to isolate manually scrolling vs scrolling caused by resizing.