Version

Set the Text Alignment on Column Headers

Please note that this control has been retired and is now obsolete to the XamDataGrid control, and as such, we recommend migrating to that control. It will not be receiving any new features, bug fixes, or support going forward. For help or questions on migrating your codebase to the XamDataGrid, please contact support.

You can set the alignment of the Column header’s text by setting the HeaderTextHorizontalAlignment and HeaderTextVerticalAlignment properties. You can set these properties on the xamGrid control, the Column, or the ColumnLayout.

Setting the property on the Column takes precedence over setting the property on the ColumnLayout.

Setting the property on the ColumnLayout takes precedence over setting the property on xamGrid.

The Column and the ColumnLayout have two additional properties:

These two read-only properties are used to validate the actual value for a particular ColumnLayout or Column.

Note
Note:

The ColumnLayout and Column’s HeaderTextHorizontalAlignment and HeaderTextVerticalAlignment are nullable enums, therefore there will not be any intellisense for them in XAML. However, xamGrid’s HeaderTextHorizontalAlignment and HeaderTextVerticalAlignment properties are not nullable and will therefore have intellisense.

In XAML:

<ig:XamGrid x:Name="MyDataGrid" ItemsSource="{Binding Source={StaticResource DataUtil}, Path=CategoriesAndProducts}"
            AutoGenerateColumns="False" HeaderTextHorizontalAlignment="Right">
   <ig:XamGrid.Columns>
      <ig:TextColumn Key="CategoryID"/>
      <ig:TextColumn Key="CategoryName" HeaderTextHorizontalAlignment="Left" />
   </ig:XamGrid.Columns>
</ig:XamGrid>

In Visual Basic:

MyDataGrid.HeaderTextHorizontalAlignment = HorizontalAlignment.Right
MyDataGrid.Columns.DataColumns("CategoryName").HeaderTextHorizontalAlignment = HorizontalAlignment.Left

In C#:

MyDataGrid.HeaderTextHorizontalAlignment = HorizontalAlignment.Right;
MyDataGrid.Columns.DataColumns["CategoryName"].HeaderTextHorizontalAlignment = HorizontalAlignment.Left;
xamWebGrid Set Column Text Alignment 01.png