ScrollViewer:禁用 Snap(弹力带效果) [英] ScrollViewer: Disable Snap (elastic band effect)

查看:21
本文介绍了ScrollViewer:禁用 Snap(弹力带效果)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 MainPage 上有一个 ScrollViewer,其中包含所有其他元素(当然 AppBars 除外).滚动工作正常,但我想禁用捕捉行为(将整个页面向左拖动,释放它,它会弹回).请参阅图像(ScrollViewer 背景:黑色,网格背景:白色).那么如何禁用这种行为呢?也称为过度滚动或反弹效果.

I have a ScrollViewer on my MainPage that contains all other elements (except the AppBars of course). Scrolling works fine, but I want to disable the snap behavior (you drag the whole page to the left, release it and it will snap back). See the image (Background of ScrollViewer: Black, Background of Grid: White). So how can I disable this behavior? Also known as overscroll or bounce effect.

我刚刚发现了 IsScrollInertiaEnabled,但将其设置为 false 无济于事.

I just found out about IsScrollInertiaEnabled, but setting this to false doesn't help.

<ScrollViewer VerticalScrollMode="Disabled" 
                  VerticalScrollBarVisibility="Disabled" 
                  HorizontalScrollBarVisibility="Visible" 
                  ZoomMode="Disabled" 
                  HorizontalSnapPointsType="None" 
                  VerticalSnapPointsType="None" 
                  ZoomSnapPointsType="None">
    <VisualStateManager>...</VisualStatemanager>
    <Grid Style="{StaticResource LayoutRootStyle}">
        <Grid.RowDefinitions>
            <RowDefinition Height="140"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <!-- Back button and page title -->
        ...
        <!-- My content grid -->

     </Grid>
</ScrollViewer>

推荐答案

要解决在滚动查看器中设置对象高度的问题,比如说.. 如果您有一个堆栈面板,请设置 Height="2000" 或否则......完成.注意:不要在滚动查看器中设置任何高度.

To solve the problem set height of the object inside the scroll viewer, let say.. if you have a stack panel, set the Height="2000" or else... and DONE. Note: Don't put any height in scroll viewer.

这篇关于ScrollViewer:禁用 Snap(弹力带效果)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆