/// <summary>
        ///  Edits the given object value using the editor style provided by BorderSidesEditor.GetEditStyle.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider is null)
            {
                return value;
            }

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

            if (_borderSidesEditorUI is null)
            {
                _borderSidesEditorUI = new BorderSidesEditorUI(this);
            }

            _borderSidesEditorUI.Start(edSvc, value);
            edSvc.DropDownControl(_borderSidesEditorUI);

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

            _borderSidesEditorUI.End();
            return value;
        }
Exemple #2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (provider != null)
            {
                IWindowsFormsEditorService edSvc =
                    (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (edSvc != null)
                {
                    if (borderSidesEditorUI == null)
                    {
                        borderSidesEditorUI = new BorderSidesEditorUI(this);
                    }
                    borderSidesEditorUI.Start(edSvc, value);
                    edSvc.DropDownControl(borderSidesEditorUI);

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

            return(value);
        }
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc == null)
         {
             return value;
         }
         if (this.borderSidesEditorUI == null)
         {
             this.borderSidesEditorUI = new BorderSidesEditorUI(this);
         }
         this.borderSidesEditorUI.Start(edSvc, value);
         edSvc.DropDownControl(this.borderSidesEditorUI);
         if (this.borderSidesEditorUI.Value != null)
         {
             value = this.borderSidesEditorUI.Value;
         }
         this.borderSidesEditorUI.End();
     }
     return value;
 }