Hi,
I have an image column in a WinGrid where i show an X image for rejected and tick image for accepted rows. However since these are image columns it does not by default sort. I want to make this column sort on the basis of the column image. Please suggest possible ways to achieve this.
Cheers,
SK
You would have to assign a custom IComparer implementation to the column's SortComparer property. It is not a very intimidating interface (there is only one method to implement); what you could do is use whatever criteria you are using to decide which image to display, and return 1 for one of those conditions and -1 for the other, depending on which rows you want to be closest to the top.
I would really appreciate some code samples. How ever in the mean time i was trying to sort the column whose values are used to set the image column values. i.e. I have a text column whose cell valuses are used to set the image value for the image column. What i was trying to do is when user clicks on the Image column header sort by the text column and set the sortindicator for the image column to None in the before sort event. But i am just not able to find out the column user clicked. Is there any Headerclick event or is there a way to find out which column was intended to be sorted by user click?