I'm writing a WPF application that is going to run on a full windows 8 touchscreen tablet (not RT).
我正在编写一个WPF应用程序,它将在完整的Windows 8触摸屏平板电脑(不是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:
所以,我有一个带滚动查看器的WPF窗口。在该滚动查看器中,我有一个StackPanel,其中包含大量文本块。见下文:
<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.
现在使用触摸屏我尝试滚动内容但它不移动。我只能使用侧面scollbar滚动内容,这不是我想要的方式。是否可以使用WPF进行触摸滚动?我也想对网格做同样的事情。
Thanks in advance.
提前致谢。
I'm using Visual Studio/Blend 2012.
我正在使用Visual Studio / Blend 2012。
1 个解决方案
#1
18
You can enable scrolling with the PanningMode
property like this: <ScrollViewer PanningMode="Both"></ScrollViewer>
.
您可以使用PanningMode属性启用滚动,如下所示:
See: MSDN
请参阅:MSDN
Mouse support
鼠标支持
If you want to implement this behavior with the mouse, please read this article.
如果要使用鼠标实现此行为,请阅读本文。
#1
18
You can enable scrolling with the PanningMode
property like this: <ScrollViewer PanningMode="Both"></ScrollViewer>
.
您可以使用PanningMode属性启用滚动,如下所示:
See: MSDN
请参阅:MSDN
Mouse support
鼠标支持
If you want to implement this behavior with the mouse, please read this article.
如果要使用鼠标实现此行为,请阅读本文。