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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternative of LoadingRow event?

Thread ID:





132854 Sep 25,2017 02:51 PM UTC Sep 28,2017 05:31 AM UTC WPF 3
Tags: SfDataGrid
Asked On September 25, 2017 02:51 PM UTC

I wanted to handle the LoadingRow  event to make a serial number row header:
     private void Dgrid_LoadingRow(object sender, DataGridRowEventArgs e)
            e.Row.Header = (e.Row.GetIndex() + 1).ToString();

but I didn't find it or any alike events, is there any Alternative approach?

Thanks in advance.

Muthukumar Kalyanasundaram [Syncfusion]
Replied On September 26, 2017 04:03 PM UTC

Hi Mohamed, 

Thank you for contacting Syncfusion support. 

You can achieve your requirement by customizing the style of GridRowHeaderCell as like below code. In that below attached sample, we have displayed the row index in GridRowHeaderCell by binding the row index value in to TextBlock. For your reference, we have attached sample and documentation link as below. Could you please refer to it. 

Code Snippet: Xaml 

<Style TargetType="syncfusion:GridRowHeaderCell"> 
    <Setter Property="Template"> 
            <ControlTemplate TargetType="syncfusion:GridRowHeaderCell"> 
                <Border x:Name="PART_RowHeaderCellBorder" 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}"> 
                        <TextBlock HorizontalAlignment="Center" 
                                    Text="{Binding RowIndex, RelativeSource={RelativeSource TemplatedParent}}" 
                                    TextAlignment="Center" /> 

For more details about displaying the row index value in row header cell in SfDataGrid, 

Please let us know if you have any other questions. 

Muthukumar K 

Replied On September 27, 2017 07:04 AM UTC

Perfect, thanks.

Muthukumar Kalyanasundaram [Syncfusion]
Replied On September 28, 2017 05:31 AM UTC

Hi Mohamed 

You are welcome. Please let us know if you need any other assistance.               
Muthukumar K  


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