Search code examples
c#xamluwptouchscrollviewer

ScrollViewer inside ComboBox popup overflows right back from the start when using touch


I have a ScrollViewer nested inside of Popup of a ComboBox. I believe it is a standard design. Even without any DependencyProperties set, this ScrollViewer has a peculiar behavior when scrolled with a touch gesture.

When I use touch & I reach the end of the ComboBoxItems inside aforementioned popup, ScrollBar moves back to the start of the popup and continues scrolling. Like that: enter image description here

I've come to believe this is a standard behavior. As you can see, English is the first language in the list, Polish & Bulgarian come in as the last languages of the list. Can you please tell me what is the name of that behavior? Can it be turned off?

I would post the ComboBox style, but I don't think it matters, because its structure largely matches the default style from: C:\Program Files (x86)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP\10.0.18362.0\Generic\generic.html

Thanks in advance!


Solution

  • When I use touch & I reach the end of the ComboBoxItems inside aforementioned popup, ScrollBar moves back to the start of the popup and continues scrolling

    It's by-design within ComboBox control for touch model. ComboBox use CarouselPanel as ItemsPanel by default. It will make the list loop scroll. If you want to disable this feature, please replace CarouselPanel with StackPanel.

    <ComboBox.ItemsPanel>
       <ItemsPanelTemplate>
          <StackPanel Orientation="Vertical" />
       </ItemsPanelTemplate>
    </ComboBox.ItemsPanel>