/// <summary> /// Bind the Value property of a UIStepper to a double property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The stepper.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">An action sets the property.</param> public static void BindValue(this BindingManager bindings, UIStepper control, Func <double> output, Action <double> input) { BindValue(bindings, control, output, input, Identity.Instance); }
/// <summary> /// Bind the Value property of a UIStepper to an integer property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The stepper.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">An action sets the property.</param> public static void BindValue(this BindingManager bindings, UIStepper control, Func <int> output, Action <int> input) { BindValue(bindings, control, output, input, ConvertInt.Instance); }
/// <summary> /// Bind the Value property of a UIStepper to a property using a value converter. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The stepper.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">An action sets the property.</param> /// <param name="converter">A custom value converter to type double.</param> /// <typeparam name="TData">The type of property to which the value is bound.</typeparam> public static void BindValue <TData>(this BindingManager bindings, UIStepper control, Func <TData> output, Action <TData> input, IValueConverter <double, TData> converter) { bindings.Bind(output, s => control.Value = converter.ConvertOutput(s), new ValueBinding <TData>(control, input, converter)); }
/// <summary> /// Bind the text of a text view to a read-only string property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The label.</param> /// <param name="output">A function that gets the property.</param> public static void BindText(this BindingManager bindings, TextView control, Func <string> output) { BindText(bindings, control, output, Identity.Instance); }
/// <summary> /// Bind the text of a text view to a read-only int property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The label.</param> /// <param name="output">A function that gets the property.</param> public static void BindText(this BindingManager bindings, TextView control, Func <int> output) { BindText(bindings, control, output, ConvertInt.Instance); }
/// <summary> /// Bind the value of a number picker to an integer property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The number picker.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">An action sets the property.</param> public static void BindValue(this BindingManager bindings, NumberPicker control, Func <int> output, Action <int> input) { BindValue(bindings, control, output, input, Identity.Instance); }
/// <summary> /// Bind the text of a text view to a read-only property using a value converter. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The label.</param> /// <param name="output">A function that gets the property.</param> /// <param name="converter">A custom value converter to string.</param> /// <typeparam name="TData">The type of the property.</typeparam> public static void BindText <TData>(this BindingManager bindings, TextView control, Func <TData> output, IDisplayDataConverter <string, TData> converter) { bindings.Bind( output, data => control.Text = converter.ConvertOutput(data)); }
/// <summary> /// Bind a button's command and Enabled property to an action and a condition. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The button.</param> /// <param name="action">The ation to perform when the button is tapped.</param> /// <param name="condition">The condition that controls when the button is enabled.</param> public static void BindCommand(this BindingManager bindings, Button control, Action action, Func <bool> condition) { bindings.Bind(condition, b => control.Enabled = b, new ButtonClickSubscription(control, action)); }
/// <summary> /// Bind the value of a number picker to a property using a value converter. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The number picker.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">An action sets the property.</param> /// <param name="converter">A custom value converter to type double.</param> /// <typeparam name="TData">The type of property to which the value is bound.</typeparam> public static void BindValue <TData>(this BindingManager bindings, NumberPicker control, Func <TData> output, Action <TData> input, IDisplayDataConverter <int, TData> converter) { bindings.Bind(output, s => control.Value = converter.ConvertOutput(s), new ValueBinding <TData>(control, input, converter)); }
/// <summary> /// Bind a button's command to an action. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The button.</param> /// <param name="action">The action to perform when the button is tapped.</param> public static void BindCommand(this BindingManager bindings, Button control, Action action) { bindings.Bind(new ButtonClickSubscription(control, action)); }
/// <summary> /// Bind the Text of a UITextField to a property using a value converter. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The text field.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">A function that sets the property.</param> /// <param name="converter">A custom value converter to string.</param> /// <typeparam name="TData">The type of the property.</typeparam> public static void BindText <TData>(this BindingManager bindings, UITextField control, Func <TData> output, Action <TData> input, IDisplayDataConverter <string, TData> converter) { bindings.Bind(output, s => control.Text = converter.ConvertOutput(s), new TextBinding <TData>(control, input, converter)); }
/// <summary> /// Bind the Text of a UITextField to an int property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The text field.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">A function that sets the property.</param> public static void BindText(this BindingManager bindings, UITextField control, Func <int> output, Action <int> input) { BindText(bindings, control, output, input, ConvertInt.Instance); }
/// <summary> /// Bind the Text of a UITextField to a string property. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The text field.</param> /// <param name="output">A function that gets the property.</param> /// <param name="input">A function that sets the property.</param> public static void BindText(this BindingManager bindings, UITextField control, Func <string> output, Action <string> input) { BindText(bindings, control, output, input, Identity.Instance); }
/// <summary> /// Bind the Text of a UILabel to a read-only property using a value converter. /// </summary> /// <param name="bindings">The binding manager.</param> /// <param name="control">The label.</param> /// <param name="output">A function that gets the property.</param> /// <param name="converter">A custom value converter to string.</param> /// <typeparam name="TData">The type of the property.</typeparam> public static void BindText <TData>(this BindingManager bindings, UILabel control, Func <TData> output, IDisplayDataConverter <string, TData> converter) { bindings.Bind(output, s => control.Text = converter.ConvertOutput(s)); }