public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context?.Instance is null || provider is null)
            {
                return(value);
            }

            if (!(provider.GetService(typeof(IWindowsFormsEditorService)) is IWindowsFormsEditorService editorService))
            {
                return(value);
            }

            MaskedTextBox maskedTextBox = context.Instance as MaskedTextBox;

            if (maskedTextBox is null)
            {
                maskedTextBox      = new MaskedTextBox();
                maskedTextBox.Text = value as string;
            }

            MaskedTextBoxTextEditorDropDown dropDown = new MaskedTextBoxTextEditorDropDown(maskedTextBox);

            editorService.DropDownControl(dropDown);

            if (dropDown.Value != null)
            {
                value = dropDown.Value;
            }

            return(value);
        }
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService service = null;

            if (((context != null) && (context.Instance != null)) && (provider != null))
            {
                service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
                if ((service == null) || (context.Instance == null))
                {
                    return(value);
                }
                MaskedTextBox instance = context.Instance as MaskedTextBox;
                if (instance == null)
                {
                    instance = new MaskedTextBox {
                        Text = value as string
                    };
                }
                MaskedTextBoxTextEditorDropDown control = new MaskedTextBoxTextEditorDropDown(instance);
                service.DropDownControl(control);
                if (control.Value != null)
                {
                    value = control.Value;
                }
            }
            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService service = null;
     if (((context != null) && (context.Instance != null)) && (provider != null))
     {
         service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
         if ((service == null) || (context.Instance == null))
         {
             return value;
         }
         MaskedTextBox instance = context.Instance as MaskedTextBox;
         if (instance == null)
         {
             instance = new MaskedTextBox {
                 Text = value as string
             };
         }
         MaskedTextBoxTextEditorDropDown control = new MaskedTextBoxTextEditorDropDown(instance);
         service.DropDownControl(control);
         if (control.Value != null)
         {
             value = control.Value;
         }
     }
     return value;
 }