亲们: 我想将 ComboBoxItem 的背景颜色设置为 RainbowRGB:
这是我当前的 xaml 代码。我更喜欢用 xaml 代码来做:
<ComboBoxItem>
<Label Content=""
Background="RainbowRGB"
Width="180"
Margin="3" />
</ComboBoxItem>
谁能指点一下?谢谢。
请您参考如下方法:
类似于:
<ComboBoxItem>
<Label Content="blah">
<Label.Background>
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="Red" Offset="0.0"/>
<GradientStop Color="Orange" Offset="0.17"/>
<GradientStop Color="Yellow" Offset="0.33"/>
<GradientStop Color="Green" Offset="0.5"/>
<GradientStop Color="Blue" Offset="0.67"/>
<GradientStop Color="Indigo" Offset="0.83"/>
<GradientStop Color="Violet" Offset="1.0"/>
</LinearGradientBrush>
</Label.Background>
</Label.Background>
</ComboBoxItem>
