Author: toshok
Date: 2006-10-05 22:25:44 -0400 (Thu, 05 Oct 2006)
New Revision: 66327

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
Log:
        * DataGrid.cs: move back to a more lazy scheme for creating the
        CurrencyManager, so we aren't updating it every time you set
        either DataSource or DataMember.  Also, don't call
        RecreateDataGridRows if the currency manager hasn't changed.

2006-10-05  Chris Toshok  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-06 02:21:37 UTC (rev 66326)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-10-06 02:25:44 UTC (rev 66327)
@@ -1,5 +1,12 @@
 2006-10-05  Chris Toshok  <[EMAIL PROTECTED]>
 
+       * DataGrid.cs: move back to a more lazy scheme for creating the
+       CurrencyManager, so we aren't updating it every time you set
+       either DataSource or DataMember.  Also, don't call
+       RecreateDataGridRows if the currency manager hasn't changed.
+
+2006-10-05  Chris Toshok  <[EMAIL PROTECTED]>
+
        * ComboBox.cs: by the time the OnSelectionChangeCommitted event is
        emitted, SelectedIndex should already be updated.  Fixes bug
        #78929.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs      
2006-10-06 02:21:37 UTC (rev 66326)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/DataGrid.cs      
2006-10-06 02:25:44 UTC (rev 66327)
@@ -565,7 +565,9 @@
                public string DataMember {
                        get { return datamember; }
                        set {
-                               SetDataSource (datasource, value);
+                               if (list_manager != null)
+                                       list_manager = null;
+                               datamember = value;
                        }
                }
 
@@ -575,7 +577,10 @@
                public object DataSource {
                        get { return datasource; }
                        set {
-                               SetDataSource (value, ListManager == null ? 
datamember : string.Empty);
+                               if (list_manager != null)
+                                       list_manager = null;
+                               datasource = value;
+                               datamember = string.Empty;
                        }
                }
 
@@ -690,7 +695,7 @@
                protected internal CurrencyManager ListManager {
                        get {
                                if (list_manager == null)
-                                       SetDataSource (DataSource, DataMember);
+                                       SetDataSource (datasource, datamember);
 
                                return list_manager;
                        }
@@ -2143,6 +2148,8 @@
                bool in_setdatasource;
                private void SetDataSource (object source, string member, bool 
recreate_rows)
                {
+                       CurrencyManager old_lm = list_manager;
+
                        /* we need this bool flag to work around a
                         * problem with OnBindingContextChanged.  once
                         * that stuff works properly, remove this
@@ -2197,17 +2204,19 @@
                        else
                                current_style.CreateColumnsForTable (false);
 
-                       /* reset first_visiblerow to 0 here before
-                        * doing anything that'll requires us to
-                        * figure out if we need a scrollbar. */
-                       vert_scrollbar.Value = 0;
-                       horiz_scrollbar.Value = 0;
-                       first_visiblerow = 0;
+                       if (old_lm != list_manager) {
+                               /* reset first_visiblerow to 0 here before
+                                * doing anything that'll requires us to
+                                * figure out if we need a scrollbar. */
+                               vert_scrollbar.Value = 0;
+                               horiz_scrollbar.Value = 0;
+                               first_visiblerow = 0;
 
-                       if (recreate_rows)
-                               RecreateDataGridRows (false);
+                               if (recreate_rows)
+                                       RecreateDataGridRows (false);
 
-                       CalcAreasAndInvalidate ();
+                               CalcAreasAndInvalidate ();
+                       }
 
                        in_setdatasource = false;
 

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

Reply via email to