gridColumn1.SortMode = DevExpress.XtraGrid.ColumnSortMode.Custom;
然后在事件CustomColumnSort
void gdv_CustomColumnSort(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnSortEventArgs e) { if (e.Column != null && e.Value1 != null && e.Value2 != null) { string value1 = e.Value1.ToString(); string value2 = e.Value2.ToString(); int result = Comparer.Default.Compare (ConvertToDecimal(value1, e.SortOrder), ConvertToDecimal(value2, e.SortOrder)); e.Result = result; e.Handled = true; } } private decimal ConvertToDecimal(string input, DevExpress.Data.ColumnSortOrder sortOrder) { decimal result = 0; if (string.IsNullOrWhiteSpace(input) || input.Equals("**") || input.Equals("--")) result = sortOrder == DevExpress.Data.ColumnSortOrder.Ascending ? 9999 : -9999; else decimal.TryParse(input, out result); return result; }