internal void SetBindableComponent(IBindableComponent value) { if (this.control != value) { IBindableComponent oldTarget = control; BindTarget(false); this.control = value; BindTarget(true); try { CheckBinding(); } catch { BindTarget(false); control = oldTarget; BindTarget(true); throw; } // We are essentially doing to the listManager what we were doing to the // BindToObject: bind only when the control is created and it has a BindingContext BindingContext.UpdateBinding((control != null && IsComponentCreated(control) ? control.BindingContext: null), this); Form form = value as Form; if (form != null) { form.Load += new EventHandler(FormLoaded); } } }
internal void SetBindableComponent(IBindableComponent value) { if (this.control != value) { IBindableComponent control = this.control; this.BindTarget(false); this.control = value; this.BindTarget(true); try { this.CheckBinding(); } catch { this.BindTarget(false); this.control = control; this.BindTarget(true); throw; } BindingContext.UpdateBinding(((this.control != null) && IsComponentCreated(this.control)) ? this.control.BindingContext : null, this); Form form = value as Form; if (form != null) { form.Load += new EventHandler(this.FormLoaded); } } }