【问题标题】:Change background color with color gradients使用颜色渐变更改背景颜色
【发布时间】:2012-07-10 23:35:19
【问题描述】:

我想从我的组合框中更改背景颜色。 但我想保留颜色渐变。

我已经尝试使用此代码,但仍然没有得到效果。

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

【问题讨论】:

    标签: wpf colors background-color gradient


    【解决方案1】:
    <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>
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-21
      • 1970-01-01
      • 2018-11-25
      • 2018-10-14
      • 1970-01-01
      相关资源
      最近更新 更多