为什么将 ScrollViewer.CanContentScroll 设置为 false 禁用虚拟化 [英] why setting ScrollViewer.CanContentScroll to false disable virtualization

查看:24
本文介绍了为什么将 ScrollViewer.CanContentScroll 设置为 false 禁用虚拟化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如大多数 WPF 开发人员所知,将 ScrollViewer.CanContentScroll 设置为 false 将禁用虚拟化;但我想知道它是如何工作的,因为我尝试在将 ScrollViewer.CanContentScroll 设置为 false 时启用虚拟化.

As most WPF developers know, setting ScrollViewer.CanContentScroll to false will disable virtualization; but I'd like to know how it works, because I try to enable virtualization while setting ScrollViewer.CanContentScroll to false.

推荐答案

"ScrollViewer 目前允许两种滚动模式:平滑逐像素滚动(CanContentScroll = false)或离散逐项滚动(CanContentScroll = true).目前 WPF 仅在逐项滚动时才支持 UI 虚拟化.Pixel-基于滚动也称为物理滚动",基于项目的滚动也称为逻辑滚动"."

"ScrollViewer currently allows two scrolling modes: smooth pixel-by-pixel scrolling (CanContentScroll = false) or discrete item-by-item scrolling (CanContentScroll = true). Currently WPF supports UI virtualization only when scrolling by item. Pixel-based scrolling is also called "physical scrolling" and item-based scrolling is also called "logical scrolling"."

虚拟化需要基于项目的滚动,因此它可以跟踪当前视图中的逻辑单元(项目)...将 ScrollViewer 设置为基于像素的滚动,不再有逻辑单元的概念,只有像素!!!

Virtualization requires an item-based scrolling so it can keep track of logical units (items) currently in view... Setting the ScrollViewer to a pixel-based scrolling there is no more concept of logic units but only pixels!!!

这篇关于为什么将 ScrollViewer.CanContentScroll 设置为 false 禁用虚拟化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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