hi ,
i have ultraGrid ,the grid dataSource binding from list of object like the follwing :
List<Stock> list = new List<Stock> ;
ultraGrid1.DataSource = list ;
Calss Stock {
private string Price;
private string Volume}
i did the follwing things in InitializeLayout:
e.Layout.Bands[0].Columns[
"Price"].Style = ColumnStyle.Double;
e.Layout.Bands[0].Columns["Volume"].Style = ColumnStyle.Double;
--------------------my Quistion is -------------------------
when I click to sort the Volume cloumn or price column the sorting not correct .
I assume setting style isn't relevant for sorting. Since your data is a string, it compares like a string. If you can edit your class, create two properties of type double that will cast the original properties and show only them in the grid. If you can't, you can create your own sort comparer an set it as the column.SortComparer.
public class GridCellComparer : IComparer<UltraGridCell>, IComparer
{
#region IComparer<UltraGridCell> Members
public int Compare(UltraGridCell x, UltraGridCell y)
IComparable xValue = double.Parse((string)x.Value);
IComparable yValue = double.Parse((string)y.Value);
if (xValue != null && yValue != null)
return xValue.CompareTo(yValue);
return x.Text.CompareTo(y.Text);
}
#endregion
#region IComparer Members
public int Compare(object x, object y)
return Compare(x as UltraGridCell, y as UltraGridCell);
I understand you'r point but i don't know where exactly call this class : GridCellComparer
may be like this :
"Price"].SortComparer = GridCellComparer