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

GridDataControl display row numbers

Thread ID:

Created:

Updated:

Platform:

Replies:

108507 Apr 24,2013 06:53 PM UTC Apr 25,2013 10:00 AM UTC WPF 1
loading
Tags: GridControl
raghavendratoranalu
Asked On April 24, 2013 06:53 PM UTC

Hi, I am using GridDataControl WPF control and binding data to the view using mvvm. How can i display row numbers in the grid ? is there a built in functionality to do that ? Basically i want to display the sequence numbers for each row in the grid.

Thanks
Raghu

Divya A [Syncfusion]
Replied On April 25, 2013 10:00 AM UTC

Hi Raghu,

 

Thanks for using Syncfusion products.

 

We have analyzed your query, you can achieve your requirement by enabling ShowRowHeader API as true and you can set the row numbers in the row header by handling QueryCellInfo event. You can handle event inside a Behavior in MVVM pattern.

 

 

Code Snippet:

 

     <syncfusion:GridDataControl x:Name="SyncGrid"

                                    AutoPopulateColumns="True"

                                    ItemsSource="{StaticResource ComboSource}"

                                    ShowAddNewRow="False"

                                    ShowFilterBar="True"

                                    ShowRowHeader="True">

            <I:Interaction.Behaviors>

                <local:QueryCellInfoBehavior/>

            </I:Interaction.Behaviors>

    </syncfusion:GridDataControl>

 

 

    GDC.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(Model_QueryCellInfo);

 

 

        void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)

        {

            var style = e.Style as GridDataStyleInfo;

 

            if (style.CellIdentity.TableCellType == GridDataTableCellType.RowHeaderCell)

            {

                e.Style.CellValue = e.Style.CellRowColumnIndex.RowIndex;

            }

        }

 

 

 

We have prepared a sample based on your requirement and attached it in the following location.

 

Sample: GridDataControlSample.zip

 

Regards,

Divya.


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

;