Question

I have the following XAML layout:

<ScrollViewer>
    <Grid>
         <GridView/>
         // several gridviews with other data and other controls
    </Grid>
</ScrollViewer>

The layout is horizontal and scrolling works, when the mouse is outside of GridView. Just at the point in which mouse hovers GridView, the scrolling stops and continues only when mouse leaves GridView. How can I solve the problem?

Was it helpful?

Solution

The mouse scroll events were eaten by the scroll viewer used inside the Grid View. To avoid this just modify the template of Grid View to something like below (remove the built in scroll viewer from grid view).

         <Style TargetType="GridView" x:Key="GridViewStyle">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <ItemsPresenter Margin="{TemplateBinding Padding}"/>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

OTHER TIPS

Thou shalt not put GridViews in a ScrollViewer! That would help. Use a single GridView with groups or a ScrollViewer with a Horizontal-ly Orientation-ed StackPanel of WrapGrids.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top