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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to show rownumber on GridTemplateColumn?

Thread ID:





144636 May 15,2019 01:43 PM UTC May 16,2019 11:26 AM UTC WPF 1
Tags: SfDataGrid
Asked On May 15, 2019 01:43 PM UTC

Hi, i have seen an example on how to show the rownumber using Text="{Binding RowIndex, RelativeSource={RelativeSource TemplatedParent}}" on "syncfusion:GridRowHeaderCell" style, but i can not replicate this with a GridTemplateColumn.

Please could you tell me how to show the rownumber in a GridTemplateColumn??

Thanks in advance.

Dinesh Babu Yadav [Syncfusion]
Replied On May 16, 2019 11:26 AM UTC

Hi Eduardo, 
Thanks for using Syncfusion products. 
If you want to display the row index in the GridTemplateColumn, you can use the following Binding to get the RowIndex property of ColumnBase from the ancestor of the GridCell.  
Refer to the following code snippet, 
Code Snippet: 
<syncfusion:GridTemplateColumn MappingName="Name"> 
            <TextBlock Text="{Binding Path=ColumnBase.RowIndex,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType=syncfusion:GridCell}}" />                                     
Dinesh Babu Yadav 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon