2007-01-07 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / TreeNodeConverter.cs
index b97e93a7da1a3f78c9031246fae03e4a7ed69899..a0a4c93c9189223eeed6818fc3a8850f5d047369 100644 (file)
 // NOT COMPLETE
 
 using System.ComponentModel;
+using System.Globalization;
 
 namespace System.Windows.Forms {
        public class TreeNodeConverter : TypeConverter {
-               #region Public Constructors
-               public TreeNodeConverter() {
-               }
-               #endregion      // Public Constructors
 
                #region Public Instance Methods
-               [MonoTODO]
-               public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) {\r
-                       return base.CanConvertTo (context, destinationType);\r
-               }\r
+               public override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
+               {
+                       if (destinationType == typeof (string))
+                               return true;
+                       return base.CanConvertTo (context, destinationType);
+               }
 
-               [MonoTODO]
-               public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType) {\r
-                       return base.ConvertTo (context, culture, value, destinationType);\r
-               }\r
+               public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture,
+                               object value, Type destinationType)
+               {
+                       // Regardless of the type of object passed in this does a ToString
+                       if (destinationType == typeof (string) && value != null)
+                               return value.ToString ();
+                       return base.ConvertTo (context, culture, value, destinationType);
+               }
 
                #endregion      // Public Instance Methods
        }