【发布时间】:2016-06-01 21:03:46
【问题描述】:
我正在使用 Windows 10 ListView,我想将 ListView 项目的默认背景颜色显示为白色,然后选择灰色。我尝试遵循样式,但没有将默认设置为白色。选中后即可使用。
<Style x:Key="TestListViewContainerStyle"
TargetType="ListViewItem">
<Setter Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter Property="Margin"
Value="0,0,0,1"/>
<Setter Property="Padding"
Value="0"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListViewItem">
<ListViewItemPresenter SelectedBackground="#E9E9E9"
PlaceholderBackground="White"
Background="White"/>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
【问题讨论】:
-
试试这个
<Style TargetType="ListViewItem"> <Setter Property="Background" Value="White"/></Style> -
不。我还没有研究过。
标签: c# xaml windows-10-universal