private void SortDefault() { _filterable.ApplySort((x, y) => { var xText = GetDisplayText(x); var yText = GetDisplayText(y); var compare = SortGroup(xText).CompareTo(SortGroup(yText)); if (compare == 0) { compare = xText.CompareTo(yText); } return(compare); }); }
private void ApplyDefaultSort() { if (string.IsNullOrEmpty(txtFind.Text)) { _availableRefs.RemoveSort(); } else { _availableRefs.ApplySort((x, y) => { var compare = SortGroup(x.KeyedName).CompareTo(SortGroup(y.KeyedName)); if (compare == 0) { compare = (x.KeyedName ?? x.Unique).CompareTo(y.KeyedName ?? y.Unique); } return(compare); }); } }
private void RefreshGrid(IEnumerable <ColWrapper> selectItems, bool topDown) { var currSort = _binding.SortDescriptions; _binding.ResetBindings(); if (currSort.Count > 0) { _binding.ApplySort(currSort); } bool currCellSet = false; foreach (var row in grid.Rows.OfType <DataGridViewRow>() .OrderBy(r => r.Index * (topDown ? 1 : -1)) .Where(r => selectItems.Contains(r.DataBoundItem))) { if (!currCellSet) { grid.CurrentCell = grid[0, row.Index]; currCellSet = true; } row.Selected = true; } }