public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (!provider.TryGetService(out IWindowsFormsEditorService editorService)) { return(value); } using (DateTimeUI dateTimeUI = new DateTimeUI()) { dateTimeUI.Start(editorService, value); editorService.DropDownControl(dateTimeUI); value = dateTimeUI.Value; dateTimeUI.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; } using (DateTimeUI eui = new DateTimeUI()) { eui.Start(edSvc, value); edSvc.DropDownControl(eui); value = eui.Value; eui.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); } using (DateTimeUI eui = new DateTimeUI()) { eui.Start(edSvc, value); edSvc.DropDownControl(eui); value = eui.Value; eui.End(); } } return(value); }
/// <include file='doc\DateTimeEditor.uex' path='docs/doc[@for="DateTimeEditor.EditValue"]/*' /> /// <devdoc> /// Edits the given object value using the editor style provided by /// GetEditorStyle. A service provider is provided so that any /// required editing services can be obtained. /// </devdoc> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { object returnValue = value; if (provider != null) { IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { if (dateTimeUI == null) { dateTimeUI = new DateTimeUI(); } dateTimeUI.Start(edSvc, value); edSvc.DropDownControl(dateTimeUI); value = dateTimeUI.Value; dateTimeUI.End(); } } return(value); }