ListView的滚动条造型 [英] ListView Scrollbar Styling

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

问题描述

我工作的一个WPF项目。我需要自定义列表视图的水平滚动条,像降低它的高度,改变背景等我如何做到这一点?

利用这一点,似乎并没有产生任何影响:

 <&的ListView GT;
     < ListView.Resources>
         <风格的TargetType =滚动条>
                < setter属性=高度值=10/>
         < /样式和GT;
     < /ListView.Resources>
 < /&的ListView GT;


解决方案

如果您要修改的条的宽度和高度,你可以看看<一个href=\"http://stackoverflow.com/questions/1321247/how-to-increase-scrollbar-width-in-wpf-scrollviewer\">this问题,这点您在使用 <方向code> System.Windows.SystemParameters 来修改这些值。

不过,我想你需要更复杂的样式(如更改背景),所以我怕你将需要控制模板部件玩。检查这两个环节(在答题发现<一个href=\"http://stackoverflow.com/questions/6527758/change-background-color-of-scrollbar-in-scrollviewer-wpf\">this问题):

I am working on a WPF project. I need to customize the horizontal scrollbar of Listview,like reducing its height,changing background etc. How do I achieve this?

Using this, doesn't seem to have any effect:

 <ListView>
     <ListView.Resources>
         <Style TargetType="ScrollBar">
                <Setter Property="Height" Value="10"/>
         </Style>
     </ListView.Resources>
 </ListView>

解决方案

If you want to modify the width and height of the bars, you can take a look at this question, which points you in the direction of using System.Windows.SystemParameters to modify those values.

However I think you require more complex styling (e.g. change the background) so I'm afraid you will need to play with control template parts. Check these two links (found in the answer to this question):

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

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