2007-01-07 Jonathan Pobst <monkey@jpobst.com>
[mono.git] / mcs / class / Managed.Windows.Forms / System.Windows.Forms / TreeNodeConverter.cs
index c515b0e06e56c73c0e9ef1b6a962c0d08ef1fa4a..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) {
+               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) {
+               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);
                }