0
有什么办法在UWP一个ListViewItem的背景被看作是两种不同的颜色,如在this control?创建ListViewItem的背景的两种颜色
有什么办法在UWP一个ListViewItem的背景被看作是两种不同的颜色,如在this control?创建ListViewItem的背景的两种颜色
这样做有两种方式。
您可以设置ListView
本身的背景和设置颜色有:
<ListView>
<ListView.Background>
<!-- some background, probably linear gradient brush
with sharp stop between the two colors -->
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="DarkGray" Offset="0.2" />
<GradientStop Color="CornflowerBlue" Offset="0.2" />
</LinearGradientBrush>
</ListView.Background>
</ListView>
另一种方法是单独设置每个项目的背景色:
<ListView>
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<Setter Property="Background">
<Setter.Value>
<LinearGradientBrush EndPoint="1,0.5" StartPoint="0,0.5">
<GradientStop Color="DarkGray" Offset="0.2" />
<GradientStop Color="CornflowerBlue" Offset="0.2" />
</LinearGradientBrush>
</Setter.Value>
</Setter>
</Style>
</ListView.ItemContainerStyle>
</ListView>
这正是我正在寻找的答案类型。谢谢! –
不客气:-)!快乐的编码! –