使用颜色渐变更改背景颜色 [英] Change background color with color gradients

查看:114
本文介绍了使用颜色渐变更改背景颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从组合框更改背景颜色. 但是我想保留颜色渐变.

I want to change the background color from my combobox. But I would like to retain the color gradients.

我尝试使用此代码,但仍然没有效果.

I've tried using this code but still does not get the effect.

<Setter Property="Background" Value="White"/> <!-- It's only white :( -->

推荐答案

<ComboBox>
    <ComboBox.Background>
        <LinearGradientBrush EndPoint="0,1">
            <GradientStopCollection>
                <GradientStop Color="Blue" Offset="0.5" />
                <GradientStop Color="White" Offset="0.5" />
            </GradientStopCollection>
        </LinearGradientBrush>
    </ComboBox.Background>
</ComboBox>

这将更改背景颜色.更改颜色和偏移以获得所需的结果.

This will change the background color. Change the Color and Offset to get your desired result.

这篇关于使用颜色渐变更改背景颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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