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

Groups collapsed when sorting

Thread ID:





90150 Sep 18,2009 12:20 PM UTC Sep 18,2009 02:33 PM UTC WPF 1
Tags: GridControl
Sven Bisaro
Asked On September 18, 2009 12:20 PM UTC


I have two questions:

1) Is there a way to disable the collapsing of the groups when a user clicks on a column to sort on that column?
2) Is there an event thrown when the user clicks on the header of a column to sort the column? (OnSorting / OnSorted )


Clay Burch [Syncfusion]
Replied On September 18, 2009 02:33 PM UTC

1) Currently, there is no property setting that will prevent losing your groups on a Sort.

2) You can catch the "OnSorted" action by listening to the grid.Model.TableProperties.SortColumns.CollectionChanged event. You can catch the "OnSorting" using a preview mouse down event.

public Window1()

//subscribe to the events after the Model has been loaded...
dataGrid.ModelLoaded += (s, e) =>
dataGrid.PreviewMouseDown += new MouseButtonEventHandler(dataGrid_PreviewMouseDown);
dataGrid.Model.TableProperties.SortColumns.CollectionChanged += new NotifyCollectionChangedEventHandler(SortColumns_CollectionChanged);

void dataGrid_PreviewMouseDown(object sender, MouseButtonEventArgs e)
RowColumnIndex cell = dataGrid.Model.Views.First().PointToCellRowColumnIndex(e.GetPosition(dataGrid));
if (cell.RowIndex == dataGrid.Model.HeaderRows + 1)
Console.WriteLine("Sorting column {0} {1}", cell.ColumnIndex, dataGrid.VisibleColumns[cell.ColumnIndex].MappingName);

void SortColumns_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
Console.WriteLine("Sorted Action= {0}", e.Action);


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