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.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

121527 Dec 24,2015 07:57 AM UTC Dec 31,2015 03:44 AM UTC WPF 5
loading
Tags: SfDataGrid
sabrina c.
Asked On December 24, 2015 07:57 AM UTC

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
Regards
Sabrina

Sivakumar R [Syncfusion]
Replied On December 24, 2015 08:44 AM UTC

Hi Sabrina,

Can you refer the below KB to display row number in RowHeader of SfDataGrid,
https://www.syncfusion.com/kb/5522

Thanks,
Sivakumar

sabrina c.
Replied On 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
regards
Sabrina

Attachment: RowHeaderGrid_5ded0eeb.rar

Sivakumar R [Syncfusion]
Replied On 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”>

<Setter.Value>

              <ControlTemplate TargetType=”syf:GridRowHeaderCell”>

              <Border x:Name=”PART_RowHeaderCellBorder”

        Background=”Yellow”

        BorderBrush=”{TemplateBinding BorderBrush}”

        BorderThickness=”{TemplateBinding BorderThickness}”>

              <Grid>

              <!—RowIndex is displayed here à

              <TextBlock HorizontalAlignment=”Center”

            VerticalAlignment=”Center”

                                           FontSize=”5”

                                           Foreground=”Black”

                                           FontFamily=”Abel”

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

            TextAlignment=”Center” />

              </Grid>

              </Border>

              </ControlTemplate>

</Setter.Value>

</Setter>
</Style>


Thanks,
Sivakumar

sabrina c.
Replied On December 30, 2015 09:09 AM UTC

It works perfectly this way
thank you very much

Regards

Sabrina

Jai Ganesh S [Syncfusion]
Replied On 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.

Regards,
Jai Ganesh S

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.

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

;