如何在WPF ScrollViewer中增加滚动条宽度? [英] How to increase scrollbar width in WPF ScrollViewer?

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

问题描述

我正在小型设备上的触摸屏上工作,滚动条的自定义宽度不好,因为我的要求之一是一切都需要用手指手势才能完成.

I am working on a touch screen on a small device and the custom width of the scroll-bar is no good as one of my requirements is that everything needs to be doable by finger gestures.

如何设置WPF ScrollViewer滚动条的宽度?

How can I set the width of the WPF ScrollViewer scrollbar?

请注意,我不想更改设备上所有滚动条的宽度(可通过Windows设置进行更改),仅更改应用程序中的滚动条.

Note that I don't wanna change the width of all the scrollbars on the device (doable through windows settings) - only the ones in my app.

推荐答案

ScrollBar模板可以获取系统参数以确定其宽度/高度(取决于方向).因此,您可以覆盖这些参数:

The ScrollBar template reaches out for system parameters to determine its width/height (depending on orientation). Therefore, you can override those parameters:

<ScrollViewer>
    <ScrollViewer.Resources>
        <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">100</sys:Double>
    </ScrollViewer.Resources>
</ScrollViewer>

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

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