开发者

How to apply WPF ScrollBar style to a particular listview?

开发者 https://www.devze.com 2023-02-14 10:44 出处:网络
Ok, here is my scrollbar style. <Style x:Key=\"{x:Type ScrollBar}\" TargetType=\"{x:Type ScrollBar}\">

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.

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?

This is driving me crazy.

Thanks.


Add the style as a resource to the ListView itself.

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

精彩评论

暂无评论...
验证码 换一张
取 消