/// <summary> /// Registers the control events. /// </summary> /// <param name="source">The source.</param> /// <param name="register">if set to <c>true</c> [register].</param> private void RegisterBindingEvents(BindingsCollection source, bool register) { foreach (Binding binding in source) { RegisterBindingEvent(binding, register); } }
/// <summary> /// Gets bindings by their bound property. /// </summary> /// <param name="This">This BindingCollection.</param> /// <param name="propertyName">Name of the property.</param> /// <returns>A list of bindings that match the given property name.</returns> public static IEnumerable <Binding> GetBindingsByPropertyName(this BindingsCollection This, string propertyName) { Contract.Requires(This != null); return(This.Cast <Binding>().Where(b => b.PropertyName == propertyName)); }
/// <summary> /// Returns an observable sequence wrapping the CollectionChanged event on the BindingsCollection instance. /// </summary> /// <param name="instance">The BindingsCollection instance to observe.</param> /// <returns>An observable sequence wrapping the CollectionChanged event on the BindingsCollection instance.</returns> public static IObservable <EventPattern <CollectionChangeEventArgs> > CollectionChangedObservable(this BindingsCollection instance) { return(Observable.FromEventPattern <CollectionChangeEventHandler, CollectionChangeEventArgs>( handler => instance.CollectionChanged += handler, handler => instance.CollectionChanged -= handler)); }
/// <summary> /// Gets a binding by its bound property. /// </summary> /// <param name="This">This BindingCollection.</param> /// <param name="propertyName">Name of the property.</param> /// <returns>The first binding that matches the given property name.</returns> public static Binding GetBindingByPropertyName(this BindingsCollection This, string propertyName) { Contract.Requires(This != null); return(This.GetBindingsByPropertyName(propertyName).First()); }