ListViewItem不伸展

时间:2013-03-16 13:07:33

标签: xaml windows-runtime

我对ListViewItem有疑问,我定义了这样的样式:

<ListView.ItemContainerStyle>
     <Style TargetType="ListViewItem">
           <Setter Property="Margin" Value="0" />
           <Setter Property="Padding" Value="0" />
           <Setter Property="HorizontalContentAlignment" Value="Stretch" />
           <Setter Property="Background" Value="Red"></Setter>
     </Style>
</ListView.ItemContainerStyle>

结果是:

SnappedImage http://img692.imageshack.us/img692/4579/snappedviewstretchl.png

如何拉伸ListViewItems?

非常感谢

1 个答案:

答案 0 :(得分:0)

问题不在于ItemContainerStyle,而在于我放入ListView的控件。

边框不适合ListViewItem,解决问题我将宽度设置为280像素(320 - 20 * 2,Snapped ViewState)