MaterialDesignInXamlToolkit icon indicating copy to clipboard operation
MaterialDesignInXamlToolkit copied to clipboard

Grouped ListView item scrolling

Open JDeuker opened this issue 5 years ago • 2 comments

Hi, for grouped ListView items the ScrollViewer doenst scroll correctly. Seems like ScrollViewer.CanContentScroll isnt switched right, because the group is scrolled as a whole item which produces awkward results.

Sample: https://github.com/JDeuker/MaterialDesignListViewTest

Thanks!

JDeuker avatar Apr 04 '19 13:04 JDeuker

I'm having the same issue here. After a little digging, it looks like the default ScrollViewer style that is used for the GridView control explicitly sets CanContentScroll to True which enables logical scrolling. To disable it, you'll need to nicely override it by throwing this into your ListView control.

<ListView.Resources>
    <Style x:Key="{x:Static GridView.GridViewScrollViewerStyleKey}" 
            BasedOn="{StaticResource {x:Static GridView.GridViewScrollViewerStyleKey}}" 
            TargetType="ScrollViewer">
        <Setter Property="CanContentScroll" Value="False"/>
    </Style>
</ListView.Resources>

I tested this with your sample and it seems to enable pixel scrolling like you would expect. Just remember now that scrolling can be a little slower depending on the size of your list.

Hope that helps!

nomiknows avatar May 28 '19 18:05 nomiknows