protected string GetNewDataSourceName(Type controlType, DataBoundControlMode mode)
        {
            DataControlFieldsEditor designerForm = this.DesignerForm as DataControlFieldsEditor;

            if (designerForm != null)
            {
                return(designerForm.GetNewDataSourceName(controlType, mode));
            }
            return(string.Empty);
        }
Esempio n. 2
0
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            DataBoundControl dataBoundControl = context.Instance as DataBoundControl;

            if (dataBoundControl != null)
            {
                IDesignerHost            service       = (IDesignerHost)provider.GetService(typeof(IDesignerHost));
                DataBoundControlDesigner designer      = (DataBoundControlDesigner)service.GetDesigner(dataBoundControl);
                IComponentChangeService  changeService = (IComponentChangeService)provider.GetService(typeof(IComponentChangeService));
                ControlDesigner.InvokeTransactedChange(dataBoundControl, delegate(object callbackContext) {
                    DataControlFieldsEditor form = new DataControlFieldsEditor(designer);
                    DialogResult result          = UIServiceHelper.ShowDialog(provider, form);
                    if ((result == DialogResult.OK) && (changeService != null))
                    {
                        changeService.OnComponentChanged(dataBoundControl, null, null, null);
                    }
                    return(result == DialogResult.OK);
                }, null, System.Design.SR.GetString("GridView_EditFieldsTransaction"));
                return(value);
            }
            return(null);
        }