I have a grid with a lot of records (50,000 +). It takes a bit of time for it to sort so I was hoping to provide the user feedback via a status bar. I hooked into the grid’s Sorting and Sorted event handlers. Via these handlers I set a property which is bound to XAML triggers which in turn updates the text in the status bar. It appears that the sort logic is asynchronous, including the Sorting and Sorted event handlers. As a result, my text does not display the ‘Sorting…’ message to the user. Do you have any suggestions on how I might be able to achieve what I’m attempting to do?
Thanks
Dan
Hello Dan,
Thank you for the feedback. I am glad that my solution was helpful to you. Please do not hesitate to contact us if you have any questions.
Gergana,
Thanks. That solution seems to work. I had to make some minor modifications to account for the filter icon. Here is what I came up with:
public void lbl_Presenter_MouseDownEvent(object sender, MouseButtonEventArgs e)
{
// See if we need to potentially send out a PreSorting event
DataItemPresenter dataItemPresenter = sender as DataItemPresenter;
if (dataItemPresenter != null &&
e != null &&
this.PreSorting != null)
// If the field is sortable
if (dataItemPresenter.Field != null &&
(dataItemPresenter.Field.LabelClickActionResolved == LabelClickAction.SortByMultipleFields ||
dataItemPresenter.Field.LabelClickActionResolved == LabelClickAction.SortByMultipleFieldsTriState ||
dataItemPresenter.Field.LabelClickActionResolved == LabelClickAction.SortByOneFieldOnly ||
dataItemPresenter.Field.LabelClickActionResolved == LabelClickAction.SortByOneFieldOnlyTriState))
// Make sure it's not the filter button that was hit
DependencyObject depObj = e.OriginalSource as DependencyObject;
if (depObj != null)
// Ignore it if it hit the filter button
var parent = WPFHelper.FindVisualParent(depObj, "Infragistics.Windows.DataPresenter.FilterButton");
if (parent == null)
// Notify of pre sorting
this.PreSorting(this, new PreSortRoutedEventArgs(dataItemPresenter.Field));
}
Thank you for your post. I have been looking into it. After some research I have made for you, I created a small sample, named xamDataGridSortingMessage. In the sample I create a style for the LabelPresenter. In this style I handle the PreviewMouseDown event for the LabelPresenter, since the sorting is happening when you click the label. In the handler for the event I simply set the text(upper left corner of the window), that should be displayed when the sorting has started.
Please refer to the attached sample and feel free to let me know if you have any further questions on the mater.