I have been racking my brains on this. I am using Gridview with a CollectionView. All fields are strings but they often contain numbers. For example, "doctor1_21". The problem is, the default sorting is not natural sorting. I followed your "Custom Sorting handling Sorting Event" example but can't seem to get it working with the CollectionView. I have six columns that are all strings and any of them should be able to sort naturally. In a perfect word, I could tell the grid or collectionview to use a custom generic IComparerinst using this dllimport and just plug it in once and any column that is selected would sort ascending and descending using this natural sort. But I simply cannot get it working. Could you tell me the best way to implement this? I have seen some where you have to designate the column name, but I would have to then do that for each column. I will do that if needed, but would be nice to have a more generic method.
internal static class SafeNativeMethods
[DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
public static extern int StrCmpLogicalW(string psz1, string psz2);