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

Set RowIndex

I want add rowindex with every sfdatagrid in my app like below.

  <Application.Resources>

 

        <ResourceDictionary>

            <ResourceDictionary.MergedDictionaries>

                             <ResourceDictionary Source="pack://application:,,,/Some;component/Styles/Accents/Blue.xaml" />

            </ResourceDictionary.MergedDictionaries>

            <Style TargetType="Syncfusion:GridRowHeaderCell">

                <Setter Property="Template">

                    <Setter.Value>

                        <ControlTemplate TargetType="Syncfusion:GridRowHeaderCell">

                            <Border x:Name="PART_RowHeaderCellBorder"

                        Background="White"

                        BorderBrush="{TemplateBinding BorderBrush}"

                        BorderThickness="{TemplateBinding BorderThickness}">

                                <Grid>

                                    <!--RowIndex is displayed here -->

                                    <TextBlock

                                    Text="{Binding RowIndex,

                                    RelativeSource={RelativeSource TemplatedParent}}"

                                    TextAlignment="Center" />

                                </Grid>

                            </Border>

                        </ControlTemplate>

                    </Setter.Value>

                </Setter>

            </Style>

        </ResourceDictionary>

    </Application.Resources>

But it's not work...... 


1 Reply

JG Jai Ganesh S Syncfusion Team April 22, 2016 04:23 AM UTC

Hi Ray,
We have prepared the sample by using your code snippet but the RowIndex is displayed in RowHeader as expected.
Loader.
Live Chat Icon For mobile
Up arrow icon