Author: rolf
Date: 2007-08-09 04:43:05 -0400 (Thu, 09 Aug 2007)
New Revision: 83719

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnCollectionTest.cs
Log:
* System.Windows.Forms/DataGridViewColumn.cs: Throw if the SortMode
  conflicts with DataGridView's SelectionMode.
* Test/System.Windows.Forms/DataGridViewColumnCollectionTest.cs: Added
  AddFullColumnSelect.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-08-09 08:33:01 UTC (rev 83718)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2007-08-09 08:43:05 UTC (rev 83719)
@@ -1,3 +1,8 @@
+2007-08-09  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
+       * DataGridViewColumn.cs: Throw if the SortMode conflicts with 
DataGridView's
+         SelectionMode.
+
 2007-08-08  Carlos Alberto Cortez <[EMAIL PROTECTED]>
 
        * ListView.cs: In ListViewItemsCollection check that owner is

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
    2007-08-09 08:33:01 UTC (rev 83718)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
    2007-08-09 08:43:05 UTC (rev 83719)
@@ -353,7 +353,9 @@
                public DataGridViewColumnSortMode SortMode {
                        get { return sortMode; }
                        set {
-                               // System.InvalidOperationException: The value 
assigned to the property conflicts with 
System.Windows.Forms.DataGridView.SelectionMode.
+                               if (value == 
DataGridViewColumnSortMode.Automatic && DataGridView != null && 
DataGridView.SelectionMode == DataGridViewSelectionMode.FullColumnSelect)
+                                       throw new InvalidOperationException 
("Column's SortMode cannot be set to Automatic while the DataGridView control's 
SelectionMode is set to FullColumnSelect.");
+
                                if (sortMode != value) {
                                        sortMode = value;
                                        if (DataGridView != null) {
@@ -451,7 +453,11 @@
                }
 
                internal override void SetDataGridView (DataGridView 
dataGridView) {
-                       base.SetDataGridView(dataGridView);
+                       if (sortMode == DataGridViewColumnSortMode.Automatic && 
dataGridView != null && dataGridView.SelectionMode == 
DataGridViewSelectionMode.FullColumnSelect) {
+                               throw new InvalidOperationException ("Column's 
SortMode cannot be set to Automatic while the DataGridView control's 
SelectionMode is set to FullColumnSelect.");
+                       }
+                       
+                       base.SetDataGridView (dataGridView);
                        if (cellTemplate != null) {
                                cellTemplate.SetDataGridView(dataGridView);
                        }

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-08-09 08:33:01 UTC (rev 83718)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2007-08-09 08:43:05 UTC (rev 83719)
@@ -1,3 +1,7 @@
+2007-08-09  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
+
+       * DataGridViewColumnCollectionTest.cs: Added AddFullColumnSelect.
+
 2007-08-08  Rolf Bjarne Kvinge <[EMAIL PROTECTED]> 
 
        * ContainerControlTest.cs, ControlTest.cs, DefaultLayoutTest.cs,

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnCollectionTest.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnCollectionTest.cs
 2007-08-09 08:33:01 UTC (rev 83718)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnCollectionTest.cs
 2007-08-09 08:43:05 UTC (rev 83719)
@@ -39,6 +39,15 @@
        public class DataGridViewColumnCollectionTest 
        {
                [Test]
+               [ExpectedException (typeof (InvalidOperationException), 
"Column's SortMode cannot be set to Automatic while the DataGridView control's 
SelectionMode is set to FullColumnSelect.")]
+               public void AddFullColumnSelect ()
+               {
+                       DataGridView dgv = new DataGridView ();
+                       dgv.SelectionMode = 
DataGridViewSelectionMode.FullColumnSelect;
+                       dgv.Columns.Add ("A", "A");
+               }
+               
+               [Test]
                public void Add ()
                {
                        DataGridViewColumnCollection c;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to