如何只在一个 ListBox 上应用 ScrollBar 和 ListBoxItem 样式?

How to apply ScrollBar and ListBoxItem styles on only one ListBox?

我有一个样式,它针对 app.xaml 中 Key 的任何 ScrollBar

x:Key="{x:Type ScrollBar}" 

但问题是它应用于应用程序中的任何滚动条,ListBoxItem 也是如此。如何只在一个 ListBox 上应用它,这样我就可以使用基于字符串的键,例如,我正在 ListBox

中寻找类似 AP 的东西
ScrollBar.Style="{StaticResource ScrollBarStyle}"

尝试在 <ListBox.Resources> 中添加明确的 Style:

<ListBox>
    <ListBox.Resources>
        <Style TargetType="ScrollBar" BasedOn="{StaticResource ScrollBarStyle}" />
    </ListBox.Resources>
    ...
</ListBox>