tags:

views:

4207

answers:

2
+1  A: 

Have a look at the GridViewColumnHeader.Role property. The sample in the documentation for the GridViewColumnHeaderRole enumeration might give you some ideas...

EDIT: Have you considered using the GridView.HeaderStyle property ?

Thomas Levesque
I don't see how the readonly Role property will help me style the whole header row.
djschwartz
It won't, but it can probably let you style the "dummy" column header with role "Padding"Anyway, I just got another idea, see my updated answer
Thomas Levesque
I did consider using GridView.HeaderStyle - because I'm used to doing ASP.NET work. This is in WPF and there doesn't seem to be (according to VS intellisense) any GridView.HeaderStyle. I'll check it out to make sure though.
djschwartz
Oops sorry, I didn't see I was looking at the ASP.NET GridView...
Thomas Levesque
A: 

I solved this issue but I think there should be a better way of doing it. The problem was that I had TextBlocks on the header of each column. The unused area didn't have anything on the header row. I just added a TextBlock with the same background in the GridView.ColumnHeaderContainerStyle and it happened to span the rest of the unused width of the grid.

<GridView.ColumnHeaderContainerStyle>
    <Style TargetType="GridViewColumnHeader">
     <Setter Property="Template">
      <Setter.Value>
       <ControlTemplate TargetType="{x:Type GridViewColumnHeader}">
        <TextBlock Text="" Padding="5">
         <TextBlock.Background>
          <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
           <GradientStop Offset="0.0" Color="#373638" />
           <GradientStop Offset="1.0" Color="#77797B" />
          </LinearGradientBrush>
         </TextBlock.Background>
        </TextBlock>
       </ControlTemplate>
      </Setter.Value>
     </Setter>
    </Style>
</GridView.ColumnHeaderContainerStyle>
djschwartz