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.

AutoGeneratedColumns

Thread ID:

Created:

Updated:

Platform:

Replies:

128559 Jan 29,2017 08:44 AM Jan 31,2017 04:10 AM WPF 3
loading
Tags: SfDataGrid
Iain Lawrie
Asked On January 29, 2017 08:44 AM

Hi
Is there a way to identify after all columns have been generated in an sfDataGrid when using
AutoGenerateColumns="True"
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 12:27 AM

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. 
 
  
Regards, 
Gnanasownthari T. 


Iain Lawrie
Replied On January 30, 2017 12:47 PM

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?

Ta

Iain

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

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. 

Regards, 
Gnanasownthari T. 


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.

;