How to Set BackGround Color for GridViewColumn
I have a ListView and I am trying to use GridView view in it. I want my GridViewColumns to have a background color. I tried CellTemplates etc ..All I could set there was background color of text but the whole cell was not getting fi开发者_StackOverflowlled uniformly.
You should set the HorizontalContentAlignment to stretch on the ItemContainer. This causes the CellTemplate text area to take up the whole space (even though the text won't). Which in turn causes your color to show up:
<ListView>
<ListView.ItemContainerStyle>
<Style>
<Setter Property="ListViewItem.HorizontalContentAlignment" Value="Stretch"/>
</Style>
</ListView.ItemContainerStyle>
</ListView>
精彩评论