2008-03-19 Ivan N. Zlatev <contact@i-nz.net>
[mono.git] / mcs / class / System.Design / System.ComponentModel.Design / MultilineStringEditor.cs
index 07b15356115a5188240ba6fdf434e843dcf82896..d0f0e2653c78ff91843f437b177a44610a10e5e6 100644 (file)
@@ -55,11 +55,9 @@ namespace System.ComponentModel.Design
 
                private IWindowsFormsEditorService editorService;
                private EditorControl control = new EditorControl ();
-               private string editContent;
 
                public MultilineStringEditor ()
                {
-                       control.LostFocus += new EventHandler (control_LostFocus);
                }
 
                public override object EditValue (ITypeDescriptorContext context, IServiceProvider provider, object value)
@@ -69,14 +67,12 @@ namespace System.ComponentModel.Design
                                editorService = (IWindowsFormsEditorService)provider.GetService (typeof (IWindowsFormsEditorService));
                                if (editorService != null)
                                {
-                                       if (!(value is string))
+                                       if (value == null)
+                                               value = String.Empty;
+                                       else if (!(value is string))
                                                return value;
 
-                                       editContent = value as string;
-                                       if (editContent == null)
-                                               editContent = String.Empty;
-                                       control.Text = editContent;
-
+                                       control.Text = (string)value;
                                        editorService.DropDownControl (control);
                                        return control.Text;
                                }
@@ -84,11 +80,6 @@ namespace System.ComponentModel.Design
                        return base.EditValue (context, provider, value);
                }
 
-               void control_LostFocus (object sender, EventArgs e)
-               {
-                       editContent = control.Text;
-               }
-
                public override UITypeEditorEditStyle GetEditStyle (ITypeDescriptorContext context)
                {
                        return UITypeEditorEditStyle.DropDown;