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

            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if (edSvc is null)
            {
                return(value);
            }

            if (_contentUI is null)
            {
                _contentUI = new ContentUI();
            }

            _contentUI.Start(edSvc, value);
            edSvc.DropDownControl(_contentUI);
            value = _contentUI.Value;
            _contentUI.End();

            return(value);
        }
Example #2
0
        /// <summary>
        ///  Edits the given object value using the editor style provided by GetEditStyle.
        /// </summary>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (!provider.TryGetService(out IWindowsFormsEditorService editorService))
            {
                return(value);
            }

            _contentUI ??= new ContentUI();

            _contentUI.Start(editorService, value);
            editorService.DropDownControl(_contentUI);
            value = _contentUI.Value;
            _contentUI.End();

            return(value);
        }