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: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Alternate way to group on SFDataGrid

Thread ID:

Created:

Updated:

Platform:

Replies:

142443 Feb 4,2019 10:35 PM UTC Feb 5,2019 08:50 AM UTC WPF 1
loading
Tags: SfDataGrid
PRASANNA
Asked On February 4, 2019 10:35 PM UTC

Are there any alternate ways to perform grouping on a given data column ?
at this point the control seems to support dragging and dripping a column on to a Group Drop area, but are there any other ways to implement grouping ?
like clicking a button inside the column ? or by right clicking on the column and grouping them ?
Can you please provide me with some examples ?


thanks 

Jayaleshwari N [Syncfusion]
Replied On February 5, 2019 08:50 AM UTC

Hi PRASANNA, 
 
Thanks for contacting Syncfusion Support. 
 
We have checked the reported query “Alternate way to group on SFDataGrid” from our side. You can achieve your requirement by adding GroupColumnDescription to SfDataGrid in any action. 
We have prepared sample to group the right clicked column in datagrid MouseRightButtonDown event. 
 
You can refer the following user guide documentation to know about programmatic grouping in SfDataGrid. 
 
Code snippet C#: Grouping done while right click on column header. 
 
private void DataGrid_PreviewMouseRightButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e) 
{ 
    GridHeaderCellControl headerCellControl = this.FindDescendant(e.OriginalSource, typeof(GridHeaderCellControl)) as GridHeaderCellControl; 
    if(headerCellControl != null) 
    { 
        if (dataGrid.GroupColumnDescriptions.Any(o => o.ColumnName == headerCellControl.Column.MappingName)) 
            return; 
 
        dataGrid.GroupColumnDescriptions.Add(new GroupColumnDescription() { ColumnName = headerCellControl.Column.MappingName }); 
    } 
} 
 
We have attached the sample for your reference and you can download the same from the following location. 
 
Please let us know if you would require further assistance. 
 
Regards, 
Jayaleshwari N. 


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.

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

Live Chat Icon For mobile
Live Chat Icon