public void CtorTest () { BindableToolStripItem item = new BindableToolStripItem (); ControlBindingsCollection data_bindings = new ControlBindingsCollection (item); Assert.AreEqual (item, data_bindings.BindableComponent, "#A1"); Assert.AreEqual (null, data_bindings.Control, "#A2"); }
// X:\jsc.svn\examples\javascript\forms\FormsDataBindingForEnabled\FormsDataBindingForEnabled\ApplicationControl.cs public static __BindingToTask <T> Add <T>(this ControlBindingsCollection DataBindings, string PropertyName, Func <Task <T> > yield) { var x = new __BindingToTask <T>(PropertyName, yield); DataBindings.Add(x); return(x); }
private static DesignBinding GetBinding(ControlBindingsCollection bindings, PropertyDescriptor property) { Binding binding = bindings[property.Name]; if (binding == null) { return DesignBinding.Null; } return new DesignBinding(binding.DataSource, binding.BindingMemberInfo.BindingMember); }
private static void SetBinding(ControlBindingsCollection bindings, PropertyDescriptor property, DesignBinding designBinding) { if (designBinding != null) { Binding binding = bindings[property.Name]; if (binding != null) { bindings.Remove(binding); } if (!designBinding.IsNull) { bindings.Add(property.Name, designBinding.DataSource, designBinding.DataMember); } } }
/// <summary> /// Releases the unmanaged resources used by the /// <see cref="T:System.Windows.Forms.ToolStripControlHost"/> and /// optionally releases the managed resources. /// </summary> /// <param name="disposing"> /// true to release both managed and unmanaged /// resources; false to release only unmanaged resources. /// </param> protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { this.Events.Dispose(); if (this.dataBindings != null) { this.dataBindings.Clear(); this.dataBindings = null; } this.bindingContext = null; } }
// Constructors. public Control() { this.name = String.Empty; this.flags = ControlFlags.Default; this.visible = true; this.anchorStyles = (byte)(AnchorStyles.Top | AnchorStyles.Left); this.imeMode = (byte)DefaultImeMode; this.rightToLeft = (byte)(RightToLeft.Inherit); this.tabIndex = -1; borderStyle = BorderStyle.None; // Create the currentParams currentParams = new CreateParams(); currentParams = CreateParams; SetStyle( ControlStyles.UserPaint | ControlStyles.StandardClick | ControlStyles.Selectable | ControlStyles.StandardDoubleClick | ControlStyles.AllPaintingInWmPaint, true); Size initialSize = DefaultSize; width = initialSize.Width; height = initialSize.Height; controlBindingsCollection = new ControlBindingsCollection(this); hoverTimer = new Timer(); hoverTimer.Interval = 1000; hoverTimer.Enabled = false; hoverTimer.Tick += new EventHandler(this.ProcessHoverTimerEvent); updateDistances = true; }
/// <summary> /// デフォルトのバインディングコレクション構築方法を定義 /// </summary> /// <param name="bindings">制御中のコントロールの DataBindings</param> /// <param name="source">本モデルに指定した DataSource</param> public abstract void OnBuildBindingsDefault(ControlBindingsCollection bindings, object source);
public override void OnBuildBindingsDefault(ControlBindingsCollection bindings, object source) { bindings.Clear(); bindings.Add("DataSource", source, "Items"); }
public BindableComponent() { BindingContext = new BindingContext(); DataBindings = new ControlBindingsCollection(this); }