问题描述
我有一个滚动查看器,里面有几个列表框.问题是如果用户在鼠标悬停在列表视图上时使用鼠标中键滚动滚动查看器.listview 将其内部的 scrollviewer 滚动到底部,然后继续捕获鼠标,从而阻止包含的 scrollviewer 滚动.
I have a scrollviewer with a couple listboxes in it. The problem is if a user uses the middle mouse roller to scroll the scrollviewer while their mouse is over a listview. The listview scrolls its internal scrollviewer to the bottom and then continues to capture the mouse, preventing the containing scrollviewer from scrolling.
关于如何处理这个问题的任何想法?
Any ideas on how to handle this?
推荐答案
这是因为 ListView 的(实际上是 ListBox 的)内容模板包装了它的项目ScrollViewer 本身.
That happens because the ListView's (ListBox's, actually) content template wraps its items with a ScrollViewer by itself.
最简单的方法是通过为内部 ListView 删除自己的 Template 来禁用它,它不会创建 ScrollViewer:
The simplest way is to disable it by dropping your own Template for the inside ListView, one that doesn't create a ScrollViewer:
<ListView>
<ListView.Template>
<ControlTemplate>
<ItemsPresenter></ItemsPresenter>
</ControlTemplate>
</ListView.Template>
...
</ListView>
顺便说一句,如果您在 ListView 中有一个 ListView(这是我的情况),也会发生同样的情况.
BTW the same happens if you have a ListView inside a ListView (this was my case).
这篇关于scrollviewer 内的 Listview 防止 scrollviewer 滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)