简体   繁体   English

如何在wp8.1中更改滚动条颜色

[英]how to change scrollbar color in wp8.1

i have this code in one of the pages 我在其中一页中有此代码

  <FlipView ScrollViewer.VerticalScrollBarVisibility="Visible" x:Name="Flip" Grid.Row="1" AutomationProperties.AutomationId="ItemsFlipView" AutomationProperties.Name="Item Details" TabIndex="1"
          DataContext="{Binding RssModel}"
          d:DataContext="{d:DesignData Source=/Assets/Data/RssDataSource.json, Type=vm:RssViewModel, IsDesignTimeCreatable=true}"
          ItemsSource="{Binding Items}"
          ItemTemplate="{StaticResource Rss1DetailDetail}"
          SelectedItem="{Binding SelectedItem, Mode=TwoWay}"
          ItemContainerStyle="{StaticResource FlipItemStyle}">

</FlipView>

i cant see the scrollbar because the background is white and i can see it when i set background to another color. 我看不到滚动条,因为背景是白色的,当我将背景设置为另一种颜色时,我可以看到它。 how i can change scrollbar color to app foreground color (globally). 我如何将滚动条颜色更改为应用程序前景色(全局)。 i know it should be on styles but i want the exact code for it. 我知道它应该在样式上,但是我想要确切的代码。

The brushes you find here https://msdn.microsoft.com/en-us/library/windows/apps/xaml/jj710190.aspx can be overridden if you put a new one into your app resources with the same key. 如果您使用相同的密钥在应用程序资源中放入新的画笔,则可以覆盖在https://msdn.microsoft.com/zh-cn/library/windows/apps/xaml/jj710190.aspx处找到的画笔。 For example the key for the scrollbar background is probably the ScrollBarTrackBackgroundThemeBrush , so for a red background just add the line <SolidColorBrush x:Key="ScrollBarTrackBackgroundThemeBrush" Color="Red" /> to your resources. 例如,滚动条背景的键可能是ScrollBarTrackBackgroundThemeBrush ,因此对于红色背景,只需将<SolidColorBrush x:Key="ScrollBarTrackBackgroundThemeBrush" Color="Red" />到您的资源中。

Edit: 编辑:

Correct key is: <SolidColorBrush x:Key="ScrollBarPanningBackgroundThemeBrush" Color="#FFCDCDCD"/> 正确的键是: <SolidColorBrush x:Key="ScrollBarPanningBackgroundThemeBrush" Color="#FFCDCDCD"/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM