2008-08-07 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Thu, 7 Aug 2008 14:44:11 +0000 (14:44 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Thu, 7 Aug 2008 14:44:11 +0000 (14:44 -0000)
* GridEntry.cs: Check if current property is a ICustomTypeDescriptor
and not the parent one (the propertyowner). Fixes the behavior of
GetConverter/GetEditor.
[Fixes bug #415452]

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

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/GridEntry.cs

index c0f7587b273c13fdd31bf9dfc100df33d2c98eb3..1e00dbe5f40bdff517dc0eefbb98eea5a770b410 100644 (file)
@@ -1,3 +1,10 @@
+2008-08-07  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * GridEntry.cs: Check if current property is a ICustomTypeDescriptor 
+       and not the parent one (the propertyowner). Fixes the behavior of 
+       GetConverter/GetEditor.
+       [Fixes bug #415452]
+
 2008-08-07  Ivan N. Zlatev  <contact@i-nz.net>
 
        * PropertyGrid.cs: Refresh should also repopulate the PropertyGrid.
index 20f9df8e86e8d62c5c1145dfbe6aeb4bfb7d1c85..1d60a27e5ee9544ebecfe73129a26e73e6a09b4f 100644 (file)
@@ -407,8 +407,9 @@ namespace System.Windows.Forms.PropertyGridInternal
                        if (PropertyDescriptor != null) {
                                try { // can happen, because we are missing some editors
                                        UITypeEditor editor = null;
-                                       if (PropertyOwner is ICustomTypeDescriptor)
-                                               editor = (UITypeEditor) ((ICustomTypeDescriptor)PropertyOwner).GetEditor (typeof (UITypeEditor));
+                                       ICustomTypeDescriptor customDescriptor = this.Value as ICustomTypeDescriptor;
+                                       if (customDescriptor != null)
+                                               editor = (UITypeEditor) customDescriptor.GetEditor (typeof (UITypeEditor));
                                        if (editor == null)
                                                editor = (UITypeEditor) PropertyDescriptor.GetEditor (typeof (UITypeEditor));
                                        return editor;
@@ -422,8 +423,9 @@ namespace System.Windows.Forms.PropertyGridInternal
                private TypeConverter GetConverter ()
                {
                        TypeConverter converter = null;
-                       if (PropertyOwner is ICustomTypeDescriptor)
-                               converter = ((ICustomTypeDescriptor)PropertyOwner).GetConverter ();
+                       ICustomTypeDescriptor customDescriptor = this.Value as ICustomTypeDescriptor;
+                       if (customDescriptor != null)
+                               converter = customDescriptor.GetConverter ();
                        if (converter == null && PropertyDescriptor != null)
                                converter = PropertyDescriptor.Converter;
                        return converter;