I have a style that targets any ScrollBar
by the Key
in the app.xaml:
x:Key="{x:Type ScrollBar}"
but the problem is that it's applied on any scroll bar in the application, the same happens for the ListBoxItem
. How to apply it on only one ListBox, so I can use a string-based key, for example, I'm looking for something like this AP in the ListBox
ScrollBar.Style="{StaticResource ScrollBarStyle}"
Try to add an explicit Style
to <ListBox.Resources>
:
<ListBox>
<ListBox.Resources>
<Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollBarStyle}" />
</ListBox.Resources>
...
</ListBox>