2012-07-11 126 views
1

我想更改我的組合框的背景顏色。 但我想保留顏色漸變。用顏色漸變更改背景顏色

enter image description here

我使用此代碼嘗試,但仍然沒有得到效果。

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

我該如何解決這個問題?

回答

2
<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> 

這會改變背景顏色。更改顏色和偏移以獲得所需的結果。