开发者

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜