当前位置: 动力学知识库 > 问答 > 编程问答 >

windows store apps - Disable Scrolling for touch input

问题描述:

I have this xaml in my page:

<ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled">

<TextBlock Name="Content" IsTextSelectionEnabled="True"

FontSize="20"

TextWrapping="Wrap"

HorizontalAlignment="Right"/>

</ScrollViewer>

There is no option to horizontally scroll with the mouse. However, if I use touch mode (I use the simulator) I can drag the text from left to right with my 'finger'.

If I comment out the ScrollViewer this behaviour stops. I can only assume that Disabled HorizontalScrollBarVisibility is not preventing the touch user from scrolling horizontally. This is a minor annoyance, but how can I prevent this horizontal scrolling?

网友答案:

You'll also want to disable HorizontalScrollMode. HorizontalScrollBarVisibility is a separate property from the one that handles the actual behavior, which I get is a bit strange because 95% of the times you either Disable both or set both to Auto, bit I guess it is just an API design choice that gives you a bit more power.

分享给朋友:
您可能感兴趣的文章:
随机阅读: