Class BindingHelper
- Namespace
- SharpConsoleUI.DataBinding
- Assembly
- SharpConsoleUI.dll
Utility methods for expression-based data binding.
public static class BindingHelper
- Inheritance
-
BindingHelper
- Inherited Members
Methods
AddDeferredBinding(object, Action<BaseControl>)
Stores a binding action to be applied when the builder produces its control.
public static void AddDeferredBinding(object builder, Action<BaseControl> apply)
Parameters
builderobjectapplyAction<BaseControl>
ApplyDeferredBindings(object, BaseControl)
Applies all deferred bindings to the built control, then removes them.
Called from Build() methods on builders that implement IControlBuilder<TControl>.
public static void ApplyDeferredBindings(object builder, BaseControl control)
Parameters
builderobjectcontrolBaseControl
CreateSetter<TTarget, TValue>(Expression<Func<TTarget, TValue>>)
Compiles a setter action from a property-access expression.
public static Action<TTarget, TValue> CreateSetter<TTarget, TValue>(Expression<Func<TTarget, TValue>> expression)
Parameters
expressionExpression<Func<TTarget, TValue>>
Returns
- Action<TTarget, TValue>
Type Parameters
TTargetTValue
GetPropertyName<T, TValue>(Expression<Func<T, TValue>>)
Extracts the property name from a member-access expression.
public static string GetPropertyName<T, TValue>(Expression<Func<T, TValue>> expression)
Parameters
expressionExpression<Func<T, TValue>>
Returns
Type Parameters
TTValue