Search code examples
wpfdatagridinfragisticsxamgrid

Infragistics XamGrid Column Header


I am using the XAMGrid basic features and for some reason the header name is not displayed at all. All I want is the manually decided column name ABC on top of the column:

As you see from the pic - there are no binding issues - since the values are coming in properly

<ig:XamGrid AutoGenerateColumns="false" ItemsSource="{Binding SalesTradesView}">
        <ig:XamGrid.Columns>
            <ig:TextColumn HeaderText="ABC" Key="ClientName">
                <ig:TextColumn.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Path=ClientName}"/>
                    </DataTemplate>
                </ig:TextColumn.HeaderTemplate>
            </ig:TextColumn>
        </ig:XamGrid.Columns>
    </ig:XamGrid>

enter image description here


Solution

  • Currently you are getting an empty TextBlock because ClientName is either empty or doesn't exist on the DataContext for the header. Note that it doesn't make sense to both set the HeaderText and the HeaderTemplate of the column and if all you want is for "ABC" to be displayed, remove the following XAML:

     <ig:TextColumn.HeaderTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Path=ClientName}"/>
        </DataTemplate>
    </ig:TextColumn.HeaderTemplate>