We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Is it possible to show the rownumber inside the rowheader of the SfDataGrid

As stated in the subject,
I've found a sample that shows the row number in another type of grid, so  is it possible to translate that code also for the SFDataGrid or is there something simpler that I didn't see in the documentation?

thank you in advance

5 Replies

SR Sivakumar R Syncfusion Team December 24, 2015 08:44 AM UTC

Hi Sabrina,

Can you refer the below KB to display row number in RowHeader of SfDataGrid,


SC sabrina c. December 29, 2015 12:32 PM UTC

Hi Sivakumar,
thank you very much for the example,
I'm late because we are on holyday here so I'm not in the office but I'm doing some work at home.

Applying the style you show in the KB to my sfgrid unfortunately does not do the trick, probably due to how I've configured the grid I suppose,
I've been able to reproduce the issue on a project that you will find attached here where I've applied to the grid the same settings I use on my project.

Applying the style as you show in the KB article, does not show the row numbers, even if the style per se is applied, in fact I've made some tests and changing the background of the Border in your style to yellow the row header becomes yellow, but the text in the textblock does not appear...

I attach the rar file with my sample project so that you can check it and tell me what I'm doing wrong in this case.

The link below should show a screen capture of the result of my test grid

thank you in advance

Attachment: RowHeaderGrid_5ded0eeb.rar

SR Sivakumar R Syncfusion Team December 29, 2015 04:42 PM UTC

Hi Sabrina,

We have checked your sample and DataContext is not set for the TextBlock inside GridRowHeader. Refer the below code snippet where changes are highlighted.

<Style TargetType=”syf:GridRowHeaderCell”>

<Setter Property=”Template”>


              <ControlTemplate TargetType=”syf:GridRowHeaderCell”>

              <Border x:Name=”PART_RowHeaderCellBorder”


        BorderBrush=”{TemplateBinding BorderBrush}”

        BorderThickness=”{TemplateBinding BorderThickness}”>


              <!—RowIndex is displayed here à

              <TextBlock HorizontalAlignment=”Center”





                                           Text=”{Binding RowIndex, RelativeSource={RelativeSource TemplatedParent}}

            TextAlignment=”Center” />







SC sabrina c. December 30, 2015 09:09 AM UTC

It works perfectly this way
thank you very much



JG Jai Ganesh S Syncfusion Team December 31, 2015 03:44 AM UTC

Hi Sabrina,

Thank you for the update.

Please let us know if you need further assistance on this.

Jai Ganesh S

Live Chat Icon For mobile
Up arrow icon