How to apply ScrollBar WPF style to a specific list?

Ok, here is my scroll style.

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

If I applied this, all scrollbars in my application will undoubtedly be affected.

Now I have 2 list (s) in my application, I need to apply this style only to a specific list, while the other remains the default scroll, any idea?

It drives me crazy.

Thank.

+3
source share
1 answer

Add a style as a resource to the ListView itself.

<ListView>
    <ListView.Resources>
        <Style TargetType="ScrollBar">
            ...
        </Style>
    </ListView.Resources>
</ListView>
+5
source

Source: https://habr.com/ru/post/1795658/


All Articles