* DataGrid.cs: When handling mouse down on a column, don't do any sort
authorCarlos Alberto Cortez <calberto.cortez@gmail.com>
Tue, 4 Aug 2009 14:50:49 +0000 (14:50 -0000)
committerCarlos Alberto Cortez <calberto.cortez@gmail.com>
Tue, 4 Aug 2009 14:50:49 +0000 (14:50 -0000)
even if the list supports it if we are empty. This way we avoid an exc
sorting the empty list, and keep the UI compatible with .net.

2009-08-04  Carlos Alberto Cortez <calberto.cortez@gmail.com>

svn path=/trunk/mcs/; revision=139347

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs

index 1e3d396493bf770f03a49e03e018a424f2a356ee..4dbbf231aaf83a6ceeaeb7fb383e587b9075784b 100644 (file)
@@ -1,3 +1,9 @@
+2009-08-04  Carlos Alberto Cortez <calberto.cortez@gmail.com>
+
+       * DataGrid.cs: When handling mouse down on a column, don't do any sort
+       even if the list supports it if we are empty. This way we avoid an exc
+       sorting the empty list, and keep the UI compatible with .net.
+
 2009-08-04  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
        * DataGrid.cs: In Edit () check we have any row before trying to use
index 9fce63cbcd912ad772de1282f50e451901f5853d..fc5b91ddbd9a44934cc26f13438914cfbead8cc2 100644 (file)
@@ -1533,6 +1533,10 @@ namespace System.Windows.Forms
 
                                if (ListManager.List is IBindingList == false)
                                        break;
+
+                               // Don't do any sort if we are empty, as .net does
+                               if (ListManager.Count == 0)
+                                       return;
                        
                                ListSortDirection direction = ListSortDirection.Ascending;
                                PropertyDescriptor prop = CurrentTableStyle.GridColumnStyles[testinfo.Column].PropertyDescriptor;