2008-12-06 Ivan N. Zlatev <contact@i-nz.net>
authorIvan Zlatev <ivan@ivanz.com>
Sat, 6 Dec 2008 16:36:06 +0000 (16:36 -0000)
committerIvan Zlatev <ivan@ivanz.com>
Sat, 6 Dec 2008 16:36:06 +0000 (16:36 -0000)
* Binding.cs: When converting the data also try with the destination
type typeconverter. This indirectly adds support for Nullable types
in our databinding layer.

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

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

index f950bb5aebf9b4372acc1723deeccd661317d240..86db66e6a1ae71b213e4a166de8f0fbc1f3e0036 100644 (file)
@@ -607,6 +607,10 @@ namespace System.Windows.Forms {
                        if (converter != null && converter.CanConvertTo (data_type))
                                return converter.ConvertTo (data, data_type);
 
+                       converter = TypeDescriptor.GetConverter (data_type);
+                       if (converter != null && converter.CanConvertFrom (data.GetType()))
+                               return converter.ConvertFrom (data);
+
                        if (data is IConvertible) {
                                object res = Convert.ChangeType (data, data_type);
                                if (data_type.IsInstanceOfType (res))
index e498c454d4131f52bb7b7594774af132cefd075c..1b59ce2feb38731c0df84bd140cf5ffac1661941 100644 (file)
@@ -1,3 +1,9 @@
+2008-12-06  Ivan N. Zlatev  <contact@i-nz.net>
+
+       * Binding.cs: When converting the data also try with the destination 
+       type typeconverter. This indirectly adds support for Nullable types 
+       in our databinding layer.
+
 2008-12-06  Ivan N. Zlatev  <contact@i-nz.net>
 
        * DataGridView.cs: When cell editing is finished focus back the