[ACCEPTED]-Setting Column Background in WPF ListView/Gridview-styles

Accepted answer
Score: 17

Set the HorizontalContentAlignment of the ItemContainerStyle:

<ListView ItemsSource="{Binding}">
        <Style TargetType="ListViewItem">
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>


alt text


Score: 5

Digging up an old thread, but I found a 5 dodgy fix for this

<Grid Background="{Binding backGround}" Margin="-6,0,-6,0">
  <TextBlock Margin="6,0,6,0" Text="{Binding myText}" TextAlignment="Right" />

Moves the margins so the 4 background color fills the entire cell, but 3 then moves them back so the text is still 2 in the right spot. Works for now until 1 it's fixed properly.

More Related questions