public SingleParameter(string name, double value, double min, double max, int index = -1, ValueBinding binder = null) { _name = name; Value = value; Min = min; Max = max; Index = index; _binder = binder; }
public void WhenSourceValueChangedAndIsNoValueThenTargetValueShouldNotBeChanged() { var sourceAdapter = new ValueAdapter(); var targetAdapter = new ValueAdapter(); var binding = new ValueBinding(targetAdapter, sourceAdapter); sourceAdapter.ValueChangedCallback(SettingsConstants.NoValue); Assert.IsFalse(targetAdapter.SetValueCalled); }
public void WhenTargetValueChangesItShouldBePassedToSource() { var sourceAdapter = new ValueAdapter(); var targetAdapter = new ValueAdapter(); var binding = new ValueBinding(targetAdapter, sourceAdapter); targetAdapter.ValueChangedCallback(5); Assert.AreEqual(5, sourceAdapter.Value); }
/// <summary> /// Disconnected events from the bound property. /// </summary> public void Disconnect() { if (this.parentObject == null) { return; } ValueBinding.Disconnect(); parentObject = null; }
protected override string?GetSortExpression() { if (string.IsNullOrEmpty(SortExpression)) { return(ValueBinding?.GetProperty <OriginalStringBindingProperty>()?.Code ?? throw new DotvvmControlException(this, $"The 'ValueBinding' property must be set on the '{GetType()}' control!")); } else { return(SortExpression); } }
public void UpdateTargetShouldNotPassNoValueFromSourceToTarget() { var sourceAdapter = new ValueAdapter(); var targetAdapter = new ValueAdapter(); var binding = new ValueBinding(targetAdapter, sourceAdapter); sourceAdapter.Value = SettingsConstants.NoValue; binding.UpdateTarget(); Assert.IsFalse(targetAdapter.SetValueCalled); }
public void UpdateTargetShouldPassValueFromSourceToTarget() { var sourceAdapter = new ValueAdapter(); var targetAdapter = new ValueAdapter(); var binding = new ValueBinding(targetAdapter, sourceAdapter); sourceAdapter.Value = 5; binding.UpdateTarget(); Assert.AreEqual(5, sourceAdapter.Value); }
public void Binding() { IDisposable binding = new ValueBinding <int>(left, right); left.Set(1); Assert.Equal(1, right.Get()); right.Set(2); Assert.Equal(2, left.Get()); binding.Dispose(); left.Set(3); Assert.Equal(2, right.Get()); }
public void Binding() { IDisposable binding = new ValueBinding<int>(left, right); left.Set(1); Assert.Equal(1, right.Get()); right.Set(2); Assert.Equal(2, left.Get()); binding.Dispose(); left.Set(3); Assert.Equal(2, right.Get()); }
public override void setValueBinding(string name, ValueBinding binding) { throw new NotSupportedException(); }
public override void setValueBinding (string name, ValueBinding binding) { throw new NotSupportedException (); }
/// <summary> /// Find a binding nested in the tree of property bidnings. /// </summary> public IBinding FindNestedBinding(string bindingName) { Argument.StringNotNullOrEmpty(() => bindingName); return(ValueBinding.FindNestedBinding(bindingName)); }