Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF ListView padding on header columns

Tags:

listview

wpf

Hi there im using a ListView in wpf and have a few columns that have auto width, now i want some padding on them but im a bit unsure how to do this? i have a red background on my header and then text in there, but i want to have some space between the border of the box and the text...

Sample image

like image 828
Peter Avatar asked Apr 08 '26 00:04

Peter


1 Answers

You could modify the HeaderTemplate of the GridViewColumn

<GridViewColumn ...>
    <GridViewColumn.HeaderTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding}" Margin="5,0,5,0"/>
        </DataTemplate>
    </GridViewColumn.HeaderTemplate>
    <GridViewColumnHeader Content="Some Header" Background="Red" />
</GridViewColumn>
like image 145
Fredrik Hedblad Avatar answered Apr 10 '26 16:04

Fredrik Hedblad