Nathan
Nathan

Reputation: 6531

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?

Upvotes: 0

Views: 547

Answers (1)

Filip Skakun
Filip Skakun

Reputation: 31724

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.

Upvotes: 3

Related Questions