void Ex05() { Given("a property whose type is BoundProperty", () => BoundProperty1 = BoundProperty <int> .Of(1)); Given("a property whose type is BoundProperty", () => BoundProperty2 = BoundProperty <int> .Of(2)); Given("a property whose type is BoundProperty", () => BoundProperty3 = BoundProperty <int> .Of(3)); When("the property binds the given three properties with a converter that converts to the sum of these values", () => Property.Bind(context => (context.GetValueAt <int>(0) + context.GetValueAt <int>(1) + context.GetValueAt <int>(2)).ToString(), BoundProperty1, BoundProperty2, BoundProperty3) ); Then("the value of the property should be the changed value", () => Property.Value == "6"); Then("the value of the first property should not be changed", () => BoundProperty1.Value == 1); Then("the value of the second property should not be changed", () => BoundProperty2.Value == 2); Then("the value of the third property should not be changed", () => BoundProperty3.Value == 3); }
public BoundPropertySpec_Binding_MultiBinding() { Property = BoundProperty <string> .Of("Test1"); }
/// <summary> /// Converts the specified value to the bound property. /// </summary> /// <typeparam name="T">The type of the property value.</typeparam> /// <param name="target">The object that is converted to the bound property.</param> /// <returns>The instance of the <see cref="BoundProperty{T}"/> class.</returns> public static BoundProperty <T> ToBoundProperty <T>(this T target) => BoundProperty <T> .Of(target);
public BoundPropertySpec_Binding_OneWay() { Property1 = BoundProperty <string> .Of("Test1"); Property2 = ObservableProperty <string> .Of("Test2"); }
public BoundPropertySpec_Binding_OneWayWithConverter() { Property1 = BoundProperty <string> .Of("Test1"); Property2 = ObservableProperty <int> .Of(3); }