Author: ivanz
Date: 2008-01-17 18:21:53 -0500 (Thu, 17 Jan 2008)
New Revision: 93219

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
Log:
2008-01-17  Ivan N. Zlatev  <[EMAIL PROTECTED]>

        * PropertyGridView.cs: Set the property value only if it has changed.
        [Fixes bug #338997]



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-01-17 23:15:19 UTC (rev 93218)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-01-17 23:21:53 UTC (rev 93219)
@@ -1,3 +1,8 @@
+2008-01-17  Ivan N. Zlatev  <[EMAIL PROTECTED]>
+
+       * PropertyGridView.cs: Set the property value only if it has changed.
+       [Fixes bug #338997]
+
 2008-01-17  Jonathan Pobst  <[EMAIL PROTECTED]>
 
        * MenuAPI.cs: Windows sends us MOUSEMOVE messages when any key is 
pressed.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2008-01-17 23:15:19 UTC (rev 93218)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs  
    2008-01-17 23:21:53 UTC (rev 93219)
@@ -829,17 +829,24 @@
                        if (desc == null)
                                return;
 
+                       bool changed = false;
                        for (int i = 0; i < 
((GridEntry)property_grid.SelectedGridItem).SelectedObjects.Length; i ++) {
                                object target = property_grid.GetTarget 
(property_grid.SelectedGridItem, i);
-                               desc.SetValue(target, newVal);
+                               object currentVal = desc.GetValue (target);
+                               if (!Object.Equals (currentVal, newVal)) {
+                                       desc.SetValue (target, newVal);
+                                       changed = true;
+                               }
                        }
 
-                       // TODO - What else should RefreshProperties.All do?
-                       RefreshPropertiesAttribute refresh_attr = 
(RefreshPropertiesAttribute) desc.Attributes [typeof 
(RefreshPropertiesAttribute)];
-                       if (refresh_attr != null && 
refresh_attr.RefreshProperties != RefreshProperties.None)
-                               Invalidate ();
-
-                       property_grid.PropertyValueChangedInternal ();
+                       if (changed) {
+                               // TODO - What else should 
RefreshProperties.All do?
+                               RefreshPropertiesAttribute refresh_attr = 
(RefreshPropertiesAttribute) desc.Attributes [typeof 
(RefreshPropertiesAttribute)];
+                               if (refresh_attr != null && 
refresh_attr.RefreshProperties != RefreshProperties.None)
+                                       Invalidate ();
+       
+                               property_grid.PropertyValueChangedInternal ();
+                       }
                }
        
                private void DropDownButtonClicked (object sender, EventArgs e) 
{
@@ -899,8 +906,7 @@
                                
(ITypeDescriptorContext)property_grid.SelectedGridItem,
                                service_container,
                                initial_value);
-                       if (value != initial_value)
-                               SetPropertyValue (value);
+                       SetPropertyValue (value);
                }
                
                private void DialogButtonClicked(object sender, EventArgs e) {

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

Reply via email to