如何申请WPF滚动条式的一个特定的列表视图? [英] How to apply WPF ScrollBar style to a particular listview?

查看:122
本文介绍了如何申请WPF滚动条式的一个特定的列表视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好吧,这是我的风格滚动条

Ok, here is my scrollbar style.

<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">       
    <Setter Property="Background" Value="#D5E0FF" />
</Style>

如果我申请这一点,在我的应用程序的所有的滚动条都会也会受到影响,毫无疑问。

If I apply this, all scrollbars in my application will get affected, undoubtedly.

现在我在我的应用程序的列表视图2(S),我需要这种风格只适用于一个特定的列表视图,而另一个保持默认的滚动条,任何想法?

Now I have 2 listview(s) in my application, I need to apply this style to only a particular listview, while another one remain default scrollbar, any idea?

这是推动我疯了。

感谢。

推荐答案

添加样式作为资源到ListView本身。

Add the style as a resource to the ListView itself.

<ListView>
    <ListView.Resources>
        <Style TargetType="ScrollBar">
            ...
        </Style>
    </ListView.Resources>
</ListView>

这篇关于如何申请WPF滚动条式的一个特定的列表视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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