문제

I'm writing a WPF application that is going to run on a full windows 8 touchscreen tablet (not RT).

However touch scrolling doesn't seem to be working. So I'm wondering if it's something I'm doing wrong or if it's even possible?

So, I have a WPF window with a scrollviewer. Within that scrollviewer I have a StackPanel which has loads of textblocks within it. See below:

<ScrollViewer>
        <StackPanel>
            <TextBlock Text="Row 1" />
            <TextBlock Text="Row 2" />
            <TextBlock Text="Row 3" />
            <TextBlock Text="Row 4" />
            <TextBlock Text="Row 5" />
            <TextBlock Text="Row 6" />
            ....
            <TextBlock Text="Row 50" />                
        </StackPanel>
    </ScrollViewer>

Now using the touchscreen I try to scroll the contents but it doesn't move. I can only scroll the contents using side scollbar which is not how I want this to work. Is it possible to get touch scrolling working with WPF? I'd also want to do the same with the grid.

Thanks in advance.

I'm using Visual Studio/Blend 2012.

도움이 되었습니까?

해결책

You can enable scrolling with the PanningMode property like this: <ScrollViewer PanningMode="Both"></ScrollViewer>.

See: MSDN

Mouse support

If you want to implement this behavior with the mouse, please read this article.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top