ScrollViewer 中的滚动条大小 [英] Scrollbar Size in ScrollViewer

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

问题描述

如何以编程方式确定 ScrollViewer 中滚动条的宽度或高度?不是基于 ScrollViewer 当前状态的当前大小(因为我可以简单地测试滚动条的可见性并根据 ViewerPortWidth/Height 和 ScrollViewer ActualWidth/Height 进行计算).

How can I programatically determine the width or height of a Scrollbar in the ScrollViewer? Not the current size based on the current state of the ScrollViewer (since I can simply test the visibility of the scrollbar and calculate against the ViewerPortWidth/Height and the ScrollViewer ActualWidth/Height).

我需要知道基于模板化宽度的滚动条可以的大小.默认值为 18(边距为 -1).但是我们都知道如果我在计算中使用 18 这个神奇的数字会发生什么.我的一些用户可以在 ScrollViewer 中对滚动条进行模板化,然后我就被搞砸了.

I need to know what size the Scrollbar's could be based on the templated width. The default is 18 (with a margin of -1). But we all know what could happen if I use the magic number of 18 in my calculations. Some of my users could template the Scrollbars in the ScrollViewer then I'd be screwed.

谢谢!

推荐答案

您可以使用 SystemParameters.ScrollWidth.

You can use SystemParameters.ScrollWidth.

这篇关于ScrollViewer 中的滚动条大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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