예제 #1
0
파일: CrudCC.cs 프로젝트: koder05/progs
        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);
            }
        }