简体   繁体   中英

What event handler can I use to tell when a DataGrid control has finished sorting?

I am simply wondering what event handler I can use to tell me when a DataGrid control has finished sorting. I know there is an event for Sorting, but I can't seem to find anything for when it has finished this operation. Any workarounds would be useful as well, as long as I can find an event that fires after the control is done sorting.

Here is the list of events on this control: http://msdn.microsoft.com/en-us/library/system.windows.controls.datagrid_events.aspx

By default, the sorting is done synchronously in the UI thread. You can do what you want if you derive a class from DataGrid and override the OnSorting method. If you call the base class OnSorting method, the sorting will be done when it returns.

public class MyDataGrid : DataGrid
{
...
  override OnSorting(DataGridSortingEventArgs eventArgs)
  {
    // sorting begins
    DataGrid::OnSorting(eventArgs);
    // sorting done
  }
}

This gives a more detailed answer: How can I be notified if a DataGrid column is sorted (and not sorting)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM