none
How do I align a GridViewColumn Header? RRS feed

  • Question

  • The following aligns the columns below the Header:

      <GridViewColumn Header="Joined" Width="90">
        <GridViewColumn.CellTemplate>
          <DataTemplate>
            <TextBlock Text="{Binding tabDateJoined}" TextAlignment="Left" />
          </DataTemplate>
        </GridViewColumn.CellTemplate>
      </GridViewColumn>

    How do I align a GridViewColumn Header?

    bhs67

    Friday, November 22, 2019 4:35 PM

All replies

  • Hi,
    you can use the HeaderTemplate.

    --
    Best Regards / Viele Grüße
    Peter Fleischer (former MVP for Developer Technologies)
    Homepage, Tipps, Tricks

    Saturday, November 23, 2019 8:47 AM
  • Hi,

    Use the HeaderContainerStyle property

     <GridView>
                        <GridViewColumn Header="Joined" Width="90">
                            <GridViewColumn.HeaderContainerStyle>
                                <Style TargetType="{x:Type GridViewColumnHeader}">
                                    <Setter Property="HorizontalContentAlignment" Value="Left" />
                                </Style>
                            </GridViewColumn.HeaderContainerStyle>
                        </GridViewColumn>
                    </GridView>

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 25, 2019 4:39 AM
    Moderator