[UWP] [XAML]使用ScrollBar / ScrollViewer的拇指颜色 [英] [UWP] [XAML] Chanaging the thumb color of ScrollBar/ScrollViewer

查看:105
本文介绍了[UWP] [XAML]使用ScrollBar / ScrollViewer的拇指颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何尽可能轻松地改变ScrollBar / ScrollViewer拇指的颜色(滚动的东西)?

How can I easily with as little effort as possible change the color of the ScrollBar/ScrollViewer thumb (the thingy that gets scrolled)?

我已经尝试了所有的解决方案我在网上发现它根本不起作用。

I already tried out all solutions I found online and it simply doesn't work.

我不敢相信这不是一个简单的刷子...它没有任何意义。

I cannot believe this isn't implemented to be a simple Brush... It doesn't make any sense.

推荐答案

你好Nastic86,

Hello Nastic86,

如果你的应用程序的最小目标版本是14393+,你将会是能够通过仅使用x:Key =" ScrollBarThumbFill *"来改变Thumb颜色。在参考资料中。

If your app's min target version is 14393+, you would be able to change Thumb color by just putting some Brushes with x:Key="ScrollBarThumbFill*" in Resources.

    <ScrollViewer>
        <ScrollViewer.Resources>
            <SolidColorBrush x:Key="ScrollBarThumbFill" Color="Gold"/>
            <SolidColorBrush x:Key="ScrollBarThumbFillPointerOver" Color="Orange"/>
            <SolidColorBrush x:Key="ScrollBarThumbFillPressed" Color="Red"/>
            <SolidColorBrush x:Key="ScrollBarThumbFillDisabled" Color="Pink"/>
        </ScrollViewer.Resources>

        <Rectangle Width="512" Height="2048">
            <Rectangle.Fill>
                <LinearGradientBrush>
                    <GradientStop Color="Orange"/>
                    <GradientStop Color="MidnightBlue" Offset="1"/>
                </LinearGradientBrush>
            </Rectangle.Fill>
        </Rectangle>
    </ScrollViewer>


这篇关于[UWP] [XAML]使用ScrollBar / ScrollViewer的拇指颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆