private void SortingHandler(object sender, DataGridSortingEventArgs e) { if (this.SelectedItem != null && cache != null && cache.RowCount > cache.PageSize) { DataGridColumn col = e.Column; var sortDirection = (col.SortDirection ?? ListSortDirection.Descending) == ListSortDirection.Descending ? ListSortDirection.Ascending : ListSortDirection.Descending; foreach (DataGridColumn c in this.Columns) { c.SortDirection = null; cache.RemoveSortOrder(c.SortMemberPath.Replace("Model.", "")); } cache.AddSortOrder(col.SortMemberPath.Replace("Model.", ""), sortDirection); col.SortDirection = sortDirection; cache.ResetPages(); e.Handled = true; ScrollToModel((this.SelectedItem as DataObj).Model); } }