WPF ListView GridView DisplayMemberBinding Center alignin content

Posted by Bigginn on Stack Overflow See other posts from Stack Overflow or by Bigginn
Published on 2010-05-23T15:17:02Z Indexed on 2010/05/23 15:21 UTC
Read the original article Hit count: 362

Filed under:
|
|

I'm trying to center align data in a ListView/Gridview where I use DisplayMemberBinding.

This is (partially) how my gridview looks:

<ListView>
    <ListView.View>
        <GridView>
            <GridView.Columns>
               <GridViewColumn DisplayMemberBinding="{Binding Path=Timi}" Width="Auto">
                   <GridViewColumnHeader Content="Tími" Click="GridViewColumnHeader_Click" ></GridViewColumnHeader>
                </GridViewColumn>
            </GridView.Columns>
        </GridView>
    </ListView.View>
</ListView>

I tried to use CellTemplate like explained on this page http://msdn.microsoft.com/en-us/library/system.windows.controls.gridviewcolumn.celltemplate.aspx but it didn't work and then later I read somewhere that one should never use cellTemplate and DisplayMemberBinding together.

So the question is : How do I center the gridview data when I use DisplayMemberBinding to bind the data to the gridview?

Thanks in advance.

© Stack Overflow or respective owner

Related posts about wpf

Related posts about gridview