我希望ScrollViewer无法处理触摸事件,我该怎么办? [英] I want touch events not to be handled by ScrollViewer, what should I do?

查看:52
本文介绍了我希望ScrollViewer无法处理触摸事件,我该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个像这样的可视树的控件。

I have a control like with a visual tree like this.

<CustomControl>
	<ScrollViewer>
		<CustomPanel/>
	<ScrollViewer/>
<CustomControl/>

当我触摸或点击自定义面板时,触摸CustomPanel和ScrollViewer中的事件'e.Hanled'为false。  但是我在CustomControl中获得的触摸事件'e.Handled'是真的。似乎ScrollViewer会将e.Hanled设置为true。

When I touch or click on the custom panel, touch events in CustomPanel and ScrollViewer ‘e.Hanled’ is false.  But touch events that I get in CustomControl has ‘e.Handled’ is true. It seems that ScrollViewer will set e.Hanled to true.

但是不希望这种情况发生,我也不想要任何默认的触摸行为在ScrollViewer中。因此,我使用以下代码禁用了所有内置触摸功能。

But don’t want this to happen, also I don’t want any default touch behavior in ScrollViewer. So, I disabled all the inbuilt touch features using the following code.

        private void Disable(ScrollViewer sv)
        {
            sv.IsHorizontalRailEnabled = false;
            sv.IsHorizontalScrollChainingEnabled = false;
            sv.IsScrollInertiaEnabled = false;
            sv.IsVerticalRailEnabled = false;
            sv.IsVerticalScrollChainingEnabled = false;
            sv.IsZoomChainingEnabled = false;
            sv.IsZoomInertiaEnabled = false;
            sv.ManipulationMode = ManipulationModes.None;
        }

即使此滚动查看器正在处理事件。

Even after this scroll viewer is handling the events.

我希望ScrollViewer不处理触摸事件,我该怎么办?

I want touch events not to be handled by ScrollViewer, what should I do?

- Jegan

- Jegan

推荐答案

你能解释一下吗?你的情景更清楚?如果您不希望用户能够滚动它,为什么使用ScrollViewer?

Can you explain your scenario more clearly? Why are you using a ScrollViewer if you don't want the user to be able to scroll it?

- Rob


这篇关于我希望ScrollViewer无法处理触摸事件,我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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