Author: calberto
Date: 2008-01-26 03:08:56 -0500 (Sat, 26 Jan 2008)
New Revision: 93978

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
Log:
2008-01-26  Carlos Alberto Cortez <[EMAIL PROTECTED]>

        * ListControl.cs: Since we are getting two BinginContextChanged events
        for the same binding context instance (when the control is added to
        form, and when the form is actually shown), take it into account only 
the
        first time for a given binding context instance.
        Fixes part of #324286.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-01-26 06:22:32 UTC (rev 93977)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-01-26 08:08:56 UTC (rev 93978)
@@ -1,3 +1,11 @@
+2008-01-26  Carlos Alberto Cortez <[EMAIL PROTECTED]>
+
+       * ListControl.cs: Since we are getting two BinginContextChanged events
+       for the same binding context instance (when the control is added to
+       form, and when the form is actually shown), take it into account only 
the
+       first time for a given binding context instance.
+       Fixes part of #324286.
+
 2008-01-26  Ivan N. Zlatev  <[EMAIL PROTECTED]>
 
         * PropertryGridView.cs: Ops.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs   
2008-01-26 06:22:32 UTC (rev 93977)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListControl.cs   
2008-01-26 08:08:56 UTC (rev 93978)
@@ -46,6 +46,7 @@
                private BindingMemberInfo value_member;
                private string display_member;
                private CurrencyManager data_manager;
+               private BindingContext last_binding_context;
 #if NET_2_0
                private IFormatProvider format_info;
                private string format_string = string.Empty;
@@ -360,9 +361,16 @@
                        }
                }
 
+               // Since this event is fired twice for the same binding context 
instance
+               // (when the control is added to the form and when the form is 
shown), 
+               // we only take into account the first time it happens
                protected override void OnBindingContextChanged (EventArgs e)
                {
                        base.OnBindingContextChanged (e);
+                       if (last_binding_context == BindingContext)
+                               return;
+
+                       last_binding_context = BindingContext;
                        ConnectToDataSource ();
 
                        if (DataManager != null) {

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

Reply via email to