[英]Xamarin Forms UWP change vertical scrollbar color
I have a Xamarin Forms app which I'd like to change the UWP vertical scrollbar color (currently it uses the default windows color).
我该怎么做?
也许可以从 UWP App.xaml
或App.xaml.cs
以某种方式做到这一点?
也许可以从 UWP App.xaml 或 App.xaml.cs 以某种方式做到这一点
当然,您可以编辑 UWP 原生 ScrollBar 样式来更新默认 ScrollBar 界面。 下面的代码正在更新拇指的颜色。 您可以将以下内容直接复制到您的 uwp app.xaml 文件中
<Application.Resources>
<ResourceDictionary>
<SolidColorBrush x:Key="ScrollBarBackgroundBrush" Color="RoyalBlue" />
<SolidColorBrush x:Key="ScrollBarPanningThumbBackground" Color="RoyalBlue" />
<SolidColorBrush x:Key="ScrollBarThumbFillPressed" Color="RoyalBlue" />
<SolidColorBrush x:Key="ScrollBarThumbFillPointerOver" Color="RoyalBlue" />
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="RoyalBlue" />
<!--The default scrollbar is too long to share here, please go to UWP generic.xaml to find the defalut `ScrollBar` style and edit base on that.-->
<Style TargetType="ScrollBar">
<Setter Property="MinWidth" Value="{ThemeResource ScrollBarSize}" />
<Setter Property="MinHeight" Value="{ThemeResource ScrollBarSize}" />
<Setter Property="Background" Value="{ThemeResource ScrollBarBackground}" />
<Setter Property="Foreground" Value="{ThemeResource ScrollBarForeground}" />
<Setter Property="BorderBrush" Value="{ThemeResource ScrollBarBorderBrush}" />
<Setter Property="IsTabStop" Value="False" />
<Setter Property="Template">
........
</ResourceDictionary>
</Application.Resources>
接受的解决方案有效。 我有点卡住了,所以把它放在那里(事后看来很明显)。 您需要编辑 UWP 项目中的 app.xaml,而不是共享代码项目中的 app.xaml。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.