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

How can I disable grouping in SfDataGrid

Thread ID:





118671 Mar 31,2015 05:57 AM UTC Apr 1,2015 06:32 PM UTC WPF 1
Tags: SfDataGrid
Andreas Söllner
Asked On March 31, 2015 05:57 AM UTC

I want to toggle grouping in SfDataGrid on an off.

Is there something better?
This code makes the columns to resize, in some cases to width = 0.

if (Grid.GroupColumnDescriptions.Count > 0)






   foreach (var droupDescription in listPropertyGroupDescription)


                        var group = new GroupColumnDescription()


                            ColumnName = droupDescription.PropertyName






Jai Ganesh S [Syncfusion]
Replied On April 1, 2015 06:32 PM UTC

Hi Andreas,


Thank you for using Syncfusion products.


We have analyzed your query and we need more information on your requirement. Based on your title, you can disable the grouping by set AllowGrouping as false. If you would like to add and remove the groups at runtime like toggle the group on or off on specific column by below code snippet,


Code Snippet [C#]:


private void Button_Click(object sender, RoutedEventArgs e)


                     if (sfdatagrid.GroupColumnDescriptions.Any())



                            sfdatagrid.GroupColumnDescriptions.Add(new GroupColumnDescription() { ColumnName = "ProductName" });




We have also prepared the sample based on this and please find the sample under the following location,


Sample Link: http://www.syncfusion.com/downloads/support/directtrac/136396/SfDataGroupingDemo-553868901.zip


If we misunderstood your requirement, could you please let us know, what you are trying to achieve from your code snippet and in which case column width will be 0. Please share the more details about your query. This would be more helpful for us to serve you in better way.


Please let us know if you need further assistance.


Thank you,

Jai Ganesh S


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