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

Alternative of LoadingRow event?

Thread ID:

Created:

Updated:

Platform:

Replies:

132854 Sep 25,2017 10:51 AM Sep 28,2017 01:31 AM WPF 3
loading
Tags: SfDataGrid
Mohamed
Asked On September 25, 2017 10:51 AM

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 12:03 PM

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"> 
        <Setter.Value> 
            <ControlTemplate TargetType="syncfusion:GridRowHeaderCell"> 
                <Border x:Name="PART_RowHeaderCellBorder" 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}"> 
                    <Grid> 
                        <TextBlock HorizontalAlignment="Center" 
                                    VerticalAlignment="Center" 
                                    Text="{Binding RowIndex, RelativeSource={RelativeSource TemplatedParent}}" 
                                    TextAlignment="Center" /> 
                    </Grid> 
                </Border> 
            </ControlTemplate> 
        </Setter.Value> 
    </Setter> 
</Style> 



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. 

Regards, 
Muthukumar K 


Mohamed
Replied On September 27, 2017 03:04 AM

Perfect, thanks.


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

Hi Mohamed 

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


CONFIRMATION

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.

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.

;