コード例 #1
0
ファイル: RadDataLayout.cs プロジェクト: RichardHaggard/BDC
        protected internal virtual void OnEditorInitializing(
            object sender,
            EditorInitializingEventArgs e)
        {
            EditorInitializingEventHandler editorInitializing = this.EditorInitializing;

            if (editorInitializing == null)
            {
                return;
            }
            editorInitializing((object)this, e);
        }
コード例 #2
0
        protected virtual Control CreateTextBox(PropertyDescriptor property)
        {
            Control control;

            if (this.DataEntryControl.Site == null)
            {
                RadTextBox radTextBox         = new RadTextBox();
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, (Control)radTextBox, radTextBox.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = e.Editor;
                this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, (Control)radTextBox, radTextBox.GetType()));
            }
            else
            {
                Control component             = (Control)(this.designerHost.CreateComponent(typeof(RadTextBox)) as RadTextBox);
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, component, component.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = !object.ReferenceEquals((object)e.Editor, (object)component) ? this.designerHost.CreateComponent(e.EditorType) as Control : e.Editor;
                this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, control, control.GetType()));
            }
            if (!control.IsHandleCreated)
            {
                control.Parent = this.DataEntryControl.Parent;
                control.CreateControl();
            }
            Binding binding = this.CreateBinding(control, "Text", property.Name);

            if (binding != null)
            {
                control.DataBindings.Add(binding);
            }
            return(control);
        }
コード例 #3
0
        protected virtual Control CreateEnum(PropertyDescriptor property)
        {
            Control control;

            if (this.DataEntryControl.Site == null)
            {
                RadDropDownList radDropDownList = new RadDropDownList();
                this.InitializeDropDownEnum((Control)radDropDownList, property);
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, (Control)radDropDownList, radDropDownList.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = e.Editor;
            }
            else
            {
                Control component = (Control)(this.designerHost.CreateComponent(typeof(RadDropDownList)) as RadDropDownList);
                this.InitializeDropDownEnum(component, property);
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, component, component.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = !object.ReferenceEquals((object)e.Editor, (object)component) ? this.designerHost.CreateComponent(e.EditorType) as Control : e.Editor;
            }
            if (control is RadDropDownList)
            {
                Binding binding = this.CreateBinding(control, "SelectedValue", property.Name);
                if (binding != null)
                {
                    control.DataBindings.Add(binding);
                }
            }
            this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, control, control.GetType()));
            return(control);
        }
コード例 #4
0
        protected virtual Control CreateControl(PropertyDescriptor property, System.Type editorType)
        {
            Control control;

            if (this.DataLayoutControl.Site == null)
            {
                Control instance = (Control)Activator.CreateInstance(editorType);
                this.SetupControlSpecificProperties(instance, property);
                instance.Name = editorType.Name + property.DisplayName;
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, instance, instance.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = e.Editor;
            }
            else
            {
                Control component = this.designerHost.CreateComponent(editorType) as Control;
                this.SetupControlSpecificProperties(component, property);
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, component, component.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = !object.ReferenceEquals((object)e.Editor, (object)component) ? this.designerHost.CreateComponent(e.EditorType) as Control : e.Editor;
            }
            if (!control.IsHandleCreated)
            {
                control.Parent = this.DataLayoutControl.Parent;
                control.CreateControl();
            }
            this.SetupControlBinding(control, property);
            this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, control, control.GetType()));
            return(control);
        }
コード例 #5
0
        protected virtual Control CreateDateTime(PropertyDescriptor property)
        {
            Control control;

            if (this.DataEntryControl.Site == null)
            {
                RadDateTimePicker           radDateTimePicker = new RadDateTimePicker();
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, (Control)radDateTimePicker, radDateTimePicker.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = e.Editor;
                this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, (Control)radDateTimePicker, radDateTimePicker.GetType()));
            }
            else
            {
                Control component             = (Control)(this.designerHost.CreateComponent(typeof(RadDateTimePicker)) as RadDateTimePicker);
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, component, component.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = !object.ReferenceEquals((object)e.Editor, (object)component) ? this.designerHost.CreateComponent(e.EditorType) as Control : e.Editor;
                this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, control, control.GetType()));
            }
            Binding binding = this.CreateBinding(control, "Value", property.Name);

            if (binding != null)
            {
                control.DataBindings.Add(binding);
            }
            return(control);
        }
コード例 #6
0
        protected virtual Control CreateImage(PropertyDescriptor property)
        {
            Control control;

            if (this.DataEntryControl.Site == null)
            {
                PictureBox pictureBox         = new PictureBox();
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, (Control)pictureBox, pictureBox.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = e.Editor;
                this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, (Control)pictureBox, pictureBox.GetType()));
            }
            else
            {
                Control component             = (Control)(this.designerHost.CreateComponent(typeof(PictureBox)) as PictureBox);
                EditorInitializingEventArgs e = new EditorInitializingEventArgs(property, component, component.GetType());
                this.OnEditorInitializing((object)this, e);
                if (e.Cancel)
                {
                    return((Control)null);
                }
                control = !object.ReferenceEquals((object)e.Editor, (object)component) ? this.designerHost.CreateComponent(e.EditorType) as Control : e.Editor;
                this.OnEditorInitialized((object)this, new EditorInitializedEventArgs(property, control, control.GetType()));
            }
            Binding binding = this.CreateBinding(control, "Image", property.Name);

            if (binding != null)
            {
                control.DataBindings.Add(binding);
            }
            return(control);
        }
コード例 #7
0
ファイル: RadDataLayout.cs プロジェクト: RichardHaggard/BDC
 private void DataEntryElement_EditorInitializing(object sender, EditorInitializingEventArgs e)
 {
     this.OnEditorInitializing((object)this, e);
 }