2009-03-19 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Thu, 19 Mar 2009 18:10:03 +0000 (18:10 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Thu, 19 Mar 2009 18:10:03 +0000 (18:10 -0000)
* DataGridView.cs, DataGridViewColumn.cs: Do not set Row/CellTemplate's
DataGridView. They do not belong to a DataGridView.
* DataGridViewTest.cs, DataGridViewColumnTest.cs: Add tests for
Row/CellTemplates being always null.
[Fixes bug #486645]

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridView.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGridViewColumn.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewColumnTest.cs
mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DataGridViewTest.cs

index 578f9a984d08940f7e3ff5fe5580beac099c8987..5187d79367d4b78f1f23acaf9b39ebdf6a68bbca 100644 (file)
@@ -1,3 +1,9 @@
+2009-03-19  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * DataGridView.cs, DataGridViewColumn.cs: Do not set Row/CellTemplate's
+       DataGridView. They do not belong to a DataGridView.
+       [Fixes bug #486645]
+
 2009-03-19  Ivan N. Zlatev  <contact@i-nz.net>
 
        * DataGridViewCellCollection.cs, DataGridViewColumnCollection.cs: 
index 853ce852b647a1adf72ba86e47b22518497ec5d7..a02d9f8f0eba638de785eef31f727cccd37321ee 100644 (file)
@@ -1134,7 +1134,6 @@ namespace System.Windows.Forms {
                        }
                        set {
                                rowTemplate = value;
-                               rowTemplate.SetDataGridView(this);
                        }
                }
 
index e726a7392cbd77fc49bdd8ada61935853c033db4..32fb2076d52926dba26a3708ebd4ec1d4bfb1178 100644 (file)
@@ -100,12 +100,7 @@ namespace System.Windows.Forms {
                [DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
                public virtual DataGridViewCell CellTemplate {
                        get { return cellTemplate; }
-                       set {
-                               cellTemplate = value;
-                               if (DataGridView != null) {
-                                       cellTemplate.SetDataGridView(DataGridView);
-                               }
-                       }
+                       set { cellTemplate = value; }
                }
 
                [Browsable (false)]
@@ -483,9 +478,6 @@ Example */
                        }
                        
                        base.SetDataGridView (dataGridView);
-                       if (cellTemplate != null) {
-                               cellTemplate.SetDataGridView(dataGridView);
-                       }
                        headerCell.SetDataGridView(dataGridView);
                }
 
index a146af66605f7944782ecfb6fbd8a4f9b7f92bec..2e0d52d4b0d2211da00677ac3b44d619775c87d7 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-19  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * DataGridViewTest.cs, DataGridViewColumnTest.cs: Add tests for 
+       Row/CellTemplates being always null.
+
 2009-03-17  Ivan N. Zlatev  <contact@i-nz.net>
 
        * DataGridViewTest.cs: Add tests for the relevance of IsHandleCreated and 
index f779606176cfe930dfd6b54c13f737c5f0c07a6a..5ea9648b112fc3f46b4485e1f3f925fee5959e9b 100644 (file)
@@ -254,6 +254,15 @@ namespace MonoTests.System.Windows.Forms
                }
 
                private int columnChanged;
+
+               [Test]
+               public void CellTemplateDataGridView ()
+               {
+                       DataGridView dgv = new DataGridView ();
+                       DataGridViewColumn dvc = new DataGridViewTextBoxColumn ();
+                       dgv.Columns.Add (dvc);
+                       Assert.IsNull (dvc.CellTemplate.DataGridView, "#1");
+               }
        }
 }
 #endif
index 7e755d76e3bca7540fce6a5dae07a09bba49fb6e..8c4cc499c65efdc596c8a115848681888b9e3ba1 100644 (file)
@@ -1808,6 +1808,13 @@ namespace MonoTests.System.Windows.Forms
                        Assert.IsTrue (dgv.IsHandleCreated, "#11");
                        Assert.AreEqual (0, dgv.RowCount, "#12");
                }
+
+               [Test]
+               public void RowTemplateDataGridView ()
+               {
+                       DataGridView gdv = new DataGridView ();
+                       Assert.IsNull (gdv.RowTemplate.DataGridView, "#1");
+               }
        }
        
        [TestFixture]