/// <summary> /// Handles the <see cref="Changing"/> event /// </summary> protected virtual void OnChanging(BindingChangingEventArgs e) { if (Changing != null) { Changing(this, e); } }
/// <summary> /// Sets the specified value to an object using this binding /// </summary> /// <remarks> /// This is called to set the value to the object. Implementors of this binding /// woulc implement logic in <see cref="InternalSetValue"/>. /// </remarks> /// <param name="dataItem">object to set the value to</param> /// <param name="value">value to set to the object</param> public void SetValue(object dataItem, T value) { var args = new BindingChangingEventArgs(value); OnChanging(args); InternalSetValue(dataItem, (T)args.Value); OnChanged(new BindingChangedEventArgs(args.Value)); }
/// <summary> /// Sets the destination object's property with the value of the source /// </summary> public void SetDestination() { if (!channeling) { channeling = true; var value = Source.DataValue; var args = new BindingChangingEventArgs(value); OnChanging(args); if (!args.Cancel) { Destination.DataValue = value; OnChanged(new BindingChangedEventArgs(value)); } channeling = false; } }
/// <summary> /// Handles the <see cref="Changing"/> event /// </summary> protected virtual void OnChanging(BindingChangingEventArgs e) { if (Changing != null) Changing(this, e); }