如何将 WPF ScrollBar 样式应用于特定列表视图?
好的,这是我的滚动条样式。
<Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
<Setter Property="Background" Value="#D5E0FF" />
</Style>
如果我应用这个,毫无疑问,我的应用程序中的所有滚动条都会受到影响。
现在我的应用程序中有 2 个列表视图,我需要将此样式仅应用于特定的列表视图,而另一个仍保留默认滚动条,知道吗?
这让我发疯。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

将样式作为资源添加到 ListView 本身。
Add the style as a resource to the ListView itself.