ScrollViewer捕获PointerPressed + PointerMoved进行滚动 [英] ScrollViewer catching PointerPressed + PointerMoved to scroll

查看:68
本文介绍了ScrollViewer捕获PointerPressed + PointerMoved进行滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在创建一个小绘图程序,我在ScrollViewer中有一个白色网格。

要检测在绘图中,我捕获PointerPressed事件以设置"isUserDrawing"。为true,我捕获了PointerMove事件,如果是"isUserDrawing",我写了一条鼠标所在的行。


使用标准鼠标效果非常好。但是当我使用模拟器通过触摸测试它时,ScrollViewer就是滚动而网格不再是触发事件了。


无论如何都要使滚动视图只用两个手指而不是一个?

解决方案

嗨。


我正在开发一个自定义滚动ScrollViewer控件,我遇到了类似的问题。


当你启用绘图时,你必须禁用所有方向的滚动。

您需要更改所有这些属性才能实现此目的:


Horizo​​ntalScrollBarVisibility ="已禁用" Horizo​​ntalScrollMode = QUOT;禁用" VerticalScrollMode = QUOT;禁用" VerticalScrollBarVisibility ="已禁用"


如果要再次滚动,只需恢复为此属性的原始值。


有时您需要更多控制滚动和手势。

如果你需要更多控制,我建议你删除ScrollViewer并使用Canvas和GestureRecognizer API。


这里是一个GestureRecognizer API样本,以备不时之需:

http ://code.msdn.microsoft.com/windowsapps/Input-Windows-8-gestures-62c6689b






Hi,

I'm currently creating a little drawing program, and I've a white grid inside a ScrollViewer.
To detect a drawing, I catch the PointerPressed event to set a "isUserDrawing" to true, and I catch the PointerMove event, and if "isUserDrawing" I do write a line where the mouse is.

It works very well with a standard mouse. But when I use the simulator to test it with touch, the ScrollViewer is Scrolling and the Grid is not anymore triggering events.

Is there anyway to make the scrollview responding only with two fingers instead of one ?

解决方案

Hi.

I was developing a custom scrolling ScrollViewer control and I had very similar problems.

When you enable drawing, you have to disable scrolling in all directions.
You need change all this properties to achieve this:

HorizontalScrollBarVisibility="Disabled" HorizontalScrollMode="Disabled" VerticalScrollMode="Disabled" VerticalScrollBarVisibility="Disabled"

When you want to scroll again, just revert back to original values of this properties.

Sometimes you'll need some more control over scrolling and gesture.
If you'll need more control, I recommend you to remove ScrollViewer and use Canvas with GestureRecognizer API.

Here is a sample of GestureRecognizer API in case you need it:
http://code.msdn.microsoft.com/windowsapps/Input-Windows-8-gestures-62c6689b


这篇关于ScrollViewer捕获PointerPressed + PointerMoved进行滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆