public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService)); IDesignerHost host = provider.GetService(typeof(IDesignerHost)) as IDesignerHost; if ((service == null) || (host == null)) { return value; } if (this.bindingFormattingDialog == null) { this.bindingFormattingDialog = new BindingFormattingDialog(); } this.bindingFormattingDialog.Context = context; this.bindingFormattingDialog.Bindings = (ControlBindingsCollection) value; this.bindingFormattingDialog.Host = host; using (DesignerTransaction transaction = host.CreateTransaction()) { service.ShowDialog(this.bindingFormattingDialog); if (this.bindingFormattingDialog.Dirty) { TypeDescriptor.Refresh(((ControlBindingsCollection) context.Instance).BindableComponent); if (transaction != null) { transaction.Commit(); } return value; } transaction.Cancel(); } } return value; }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if (provider != null) { IWindowsFormsEditorService service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); IDesignerHost host = provider.GetService(typeof(IDesignerHost)) as IDesignerHost; if ((service == null) || (host == null)) { return(value); } if (this.bindingFormattingDialog == null) { this.bindingFormattingDialog = new BindingFormattingDialog(); } this.bindingFormattingDialog.Context = context; this.bindingFormattingDialog.Bindings = (ControlBindingsCollection)value; this.bindingFormattingDialog.Host = host; using (DesignerTransaction transaction = host.CreateTransaction()) { service.ShowDialog(this.bindingFormattingDialog); if (this.bindingFormattingDialog.Dirty) { TypeDescriptor.Refresh(((ControlBindingsCollection)context.Instance).BindableComponent); if (transaction != null) { transaction.Commit(); } return(value); } transaction.Cancel(); } } return(value); }
private void FormatControlFinishedLoading() { BindingFormattingDialog dialog = null; FormatStringDialog dialog2 = null; for (Control control = base.Parent; control != null; control = control.Parent) { dialog = control as BindingFormattingDialog; dialog2 = control as FormatStringDialog; if ((dialog != null) || (dialog2 != null)) { break; } } if (dialog2 != null) { dialog2.FormatControlFinishedLoading(); } }