更改垂直滚动条的宽度 [英] Changing the width of a vertical scrollbar

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

问题描述

在我的Silverlight 4应用程序中,我有一个ScrollViewer.我想更改Scrollviewer的垂直Scrollbar的宽度,使其更薄.我已经搜索了一个简单的解决方案,但不需要/不想重新设置整个Scrollbar的样式. 我在想类似的东西:

in my Silverlight 4 application, I have a ScrollViewer. I want to change the width of the vertical Scrollbar of the Scrollviewer, to make it a bit thinner. I have searched for a simple solution, but I do not need/want to restyle the whole Scrollbar. I was thinking about something like:

MyScrollViewer.VerticalScrollbar.Width = 8;

但是没有这样的财产.知道如何缩小滚动条的宽度吗?

But there is no such Property. Any idea, how to make the scroll bar thinner?

在此先感谢,
弗兰克

Thanks in advance,
Frank

推荐答案

没有直接方法可以获取scrollviewer的垂直滚动条. 下面的代码将从视觉树中提取垂直滚动条,您可以更改滚动条"的属性

There is no direct way of getting the vertical scrollbar of the scrollviewer. Below code will extract the vertical scroll bar from the visualtree and you can do the changes in properties of the 'scrollbar'

ScrollBar vertical = ((FrameworkElement)VisualTreeHelper.GetChild(scrollviewer1, 0)).FindName("VerticalScrollBar") as ScrollBar;

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

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