Disable the vertical scroll-behavior of the scrollviewer in windows phone

吃可爱长大的小学妹 提交于 2021-01-27 05:44:43

问题


I am using a scrollviewer to show some buttons displayed horizontally, I can use the scrollviewer to scroll from left to right, and visa versa. But the user can still drag and scroll downward, though the scrollViewer wil scroll back to the top automatically. This provides a bad UX, thus I want to disable the vertical scroll-behavior of the scrollviewer, user can just scroll horizontally. any thoughts? thanks.

<ScrollViewer Grid.Row="2" HorizontalScrollBarVisibility="Hidden" Width="auto" Height="100" Margin="0,12" VerticalAlignment="Bottom">
   <StackPanel Orientation="Horizontal">
                    <Button Height="100" Width="100" Margin="0" Style="{StaticResource ButtonStyle}" Click="Origin_Click">
                    </Button>
<Button Height="100" Width="100" Margin="0" Style="{StaticResource ButtonStyle}" Click="Origin_Click">
                    </Button>
<Button Height="100" Width="100" Margin="0" Style="{StaticResource ButtonStyle}" Click="Origin_Click">
                    </Button>
</StackPanel>    
            </ScrollViewer>

v


回答1:


Use VerticalScrollBarVisibility="disabled"




回答2:


For windows phone 8 and 8.1 :

To disable vertical scrolling in scrollviewer use following:

<ScrollViewer VerticalScrollMode="Disabled"/>

To Disable horizontal scrolling in scrollviewer use following:

<ScrollViewer HorizontalScrollMode="Disabled">


来源:https://stackoverflow.com/questions/9459751/disable-the-vertical-scroll-behavior-of-the-scrollviewer-in-windows-phone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!