禁用ScrollViewer的Horizo​​ntalScrollMode并在父级中接收操作事件 [英] Disable HorizontalScrollMode of ScrollViewer and receiving Manipulation events in the parent

查看:61
本文介绍了禁用ScrollViewer的Horizo​​ntalScrollMode并在父级中接收操作事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个垂直滚动的ScrollViewer(Horizo​​ntalScrollMode =" Disabled"),我需要按顺序监听父元素中的Manipulation事件水平滚动。问题是父进程中没有引发操作事件。

I have a ScrollViewer which scrolls vertically(HorizontalScrollMode="Disabled"), and I need to listen to the Manipulation events in a parent element in order to scroll horizontally. The problem is that the manipulation events are not raised in the parent.

我已经在ScrollViewer中检查了设置IsHitTestVisible = False,在父进程中正确接收了事件,我也试过了在Scrollviewer中设置ManipulationMode = None但没有成功。

I already checked that setting IsHitTestVisible=False in the ScrollViewer, the events are properly received in the parent, and I also tried setting ManipulationMode=None in the Scrollviewer with no success.

提前致谢,

Alvaro。

Alvaro Rivoir

Alvaro Rivoir

推荐答案

ScrollViewers和ManipulationMode没有他们看起来可能的确切关系,滚动是不同的。问题 相反,对于您所描述的场景,它听起来就像您想要的是Scroll Chaining。

ScrollViewers and ManipulationMode don't have the exact apparent relationship they may seem to, Scrolling is a different issue.  Rather, for the scenario you're describing it sounds like what you want is Scroll Chaining.

对于你所描述的内容,尤其是"父元素水平滚动"这样的事情最有意义:

For what you've described, especially "parent element scrolling horizontally" something like this makes the most sense:

        <ScrollViewer Width="500" Height="500" Background="Green" HorizontalScrollMode="Enabled"  HorizontalScrollBarVisibility="Auto">
            <ScrollViewer Width="1600" Background="Red" Margin="20" Height="600" IsHorizontalScrollChainingEnabled="True">
                <Ellipse Fill="Blue" Height="1000" />
            </ScrollViewer>
        </ScrollViewer>



如果不这样做,请发送一个repro项目或代码/标记我很乐意提出更多建议。


Failing that, send a repro project or code/markup and I'll gladly make more suggestions.

希望这会有所帮助,

Matt

Hope this helps,
Matt


这篇关于禁用ScrollViewer的Horizo​​ntalScrollMode并在父级中接收操作事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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