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


Thread ID:





128559 Jan 29,2017 01:44 PM UTC Jan 31,2017 09:10 AM UTC WPF 3
Tags: SfDataGrid
Iain Lawrie
Asked On January 29, 2017 01:44 PM UTC

Is there a way to identify after all columns have been generated in an sfDataGrid when using
In DataGrid there's an AutoGeneratedColumns event but I don't see a similar thing in sfDataGrid, just an AutoGeneratingColumn...

Gnanasownthari Thirugnanam [Syncfusion]
Replied On January 30, 2017 05:27 AM UTC

Hi Iain, 
Thank you for contact Syncfusion support. 
We have analyzed your query, In SfDataGrid we have AutoGeneratingColumn event. Using this event we can customize or cancel the auto generate column. 

You can refer the below UG link for more information. 
Gnanasownthari T. 

Iain Lawrie
Replied On January 30, 2017 05:47 PM UTC

Many thanks for the reply but what I'm trying to do is have an event that fires after all the columns are generated and I can access the column count of the grid. At the minute when I use AutoGeneratingColumn the column count of the grid always returns 0 no matter how many columns have been generated. Maybe I'm doing something wrong - should I be able to get a count of auto generated columns from the AutoGeneratingColumn event?



Gnanasownthari Thirugnanam [Syncfusion]
Replied On January 31, 2017 09:10 AM UTC

Hi Iain, 

We have analyzed your query. We regret to inform you that, we can’t get the column count in AutoGenratingColumn event because columns are added in the DataGrid.Columns Collection only  after all columns are generated. We suggest to use separate field to maintain ColumnCount in AutoGenratingColumn event otherwise you can get the column count in ItemsSourceChanged event as like below code example. 
this.datagrid.ItemsSourceChanged += Datagrid_ItemsSourceChanged; 
private void Datagrid_ItemsSourceChanged(object sender, GridItemsSourceChangedEventArgs e) 
    var sfDataGrid = e.OriginalSender as SfDataGrid; 
    var columnCount = sfDataGrid.Columns.Count; 

We have prepared the sample as per your requirement, you can download the same from below mentioned location. 

Sample location. 

Please let us know if you have any further assistance on this. 

Gnanasownthari T. 


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