The mentioned behavior is expected, because your [Time] column has data type of string. Maybe one possible approach to solve this task, could be if you are using IComparer interface. By this way you could implement your custom sorting behavior.
I have similar sample where I used IComparer interface. There I should sort integer by absolute values. You could use this sample as a starting point. More details about IComparer interface you could find at: http://help.infragistics.com/Help/NetAdvantage/WinForms/2013.1/CLR4.0/html/Infragistics4.Win.Misc.v13.1~Infragistics.Win.Misc.NavigationBarLocationsCollection~Sort(IComparer).html
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Collections;
using Infragistics.Win.UltraWinGrid;
namespace UltraGridSortByABSValue
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
DataTable dt = new DataTable();
dt.Columns.Add("A", typeof(string));
dt.Columns.Add("B", typeof(double));
dt.Columns.Add("C", typeof(double));
dt.Rows.Add("Test 1", 10, 23.3);
dt.Rows.Add("Test 2", 30, 23.4);
dt.Rows.Add("Test 3", -20, 21.3);
dt.Rows.Add("Test 4", -40, 12.3);
dt.Rows.Add("Test 5", -50, -22.7);
dt.Rows.Add("Test 6", 60, 22.3);
dt.Rows.Add("Test 7", -70, 26.8);
dt.Rows.Add("Test 8", 80, 13.3);
dt.Rows.Add("Test 9", 90, 29.1);
ultraGrid1.DataSource = dt;
ultraGrid1.DisplayLayout.Bands[0].Columns["C"].Style = Infragistics.Win.UltraWinGrid.ColumnStyle.Currency;
ultraGrid1.DisplayLayout.Bands[0].Columns["C"].Format = "$ #,##0.00;$ -#,##0.00; $ -";
ultraGrid1.DisplayLayout.Bands[0].Columns["C"].CellAppearance.TextHAlign = Infragistics.Win.HAlign.Right;
}
private void ultraGrid1_AfterSortChange(object sender, BandEventArgs e)
{
ultraGrid1.DisplayLayout.Bands[0].Columns["B"].SortComparer = new SortComparer();
}
private void ultraGrid1_InitializeGroupByRow(object sender, InitializeGroupByRowEventArgs e)
{
//e.Row.Column.SortComparer = new SortComparer();
}
}
public class SortComparer : IComparer
{
// Custom Sorting - Sort by ABS values
int IComparer.Compare(object x, object y)
{
UltraGridCell cell1 = x as UltraGridCell;
UltraGridCell cell2 = y as UltraGridCell;
string string1 = Math.Abs((double)cell1.Value).ToString();
string string2 = Math.Abs((double)cell2.Value).ToString();
int ret;
if (string1 == null)
{
ret = -1;
}
else
if (string2 == null)
{
ret = 1;
}
else
{
ret = string.Compare(string1, string2, true, System.Globalization.CultureInfo.CurrentCulture);
}
return ret;
}
}
}