Class BindingExtensions
- Namespace
- SharpConsoleUI.DataBinding
- Assembly
- SharpConsoleUI.dll
Extension methods for declarative one-way and two-way data binding.
public static class BindingExtensions
- Inheritance
-
BindingExtensions
- Inherited Members
Methods
BindTwoWay<TControl, TSource, TValue>(TControl, TSource, Expression<Func<TSource, TValue>>, Expression<Func<TControl, TValue>>)
Creates a two-way binding between a source property and a control property (same type). Both sides must implement INotifyPropertyChanged.
public static TControl BindTwoWay<TControl, TSource, TValue>(this TControl control, TSource source, Expression<Func<TSource, TValue>> sourceExpr, Expression<Func<TControl, TValue>> targetExpr) where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
controlTControlsourceTSourcesourceExprExpression<Func<TSource, TValue>>targetExprExpression<Func<TControl, TValue>>
Returns
- TControl
Type Parameters
TControlTSourceTValue
BindTwoWay<TControl, TSource, TSrc, TTgt>(TControl, TSource, Expression<Func<TSource, TSrc>>, Expression<Func<TControl, TTgt>>, Func<TSrc, TTgt>, Func<TTgt, TSrc>)
Creates a two-way binding with converters in both directions.
public static TControl BindTwoWay<TControl, TSource, TSrc, TTgt>(this TControl control, TSource source, Expression<Func<TSource, TSrc>> sourceExpr, Expression<Func<TControl, TTgt>> targetExpr, Func<TSrc, TTgt> toTarget, Func<TTgt, TSrc> toSource) where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
controlTControlsourceTSourcesourceExprExpression<Func<TSource, TSrc>>targetExprExpression<Func<TControl, TTgt>>toTargetFunc<TSrc, TTgt>toSourceFunc<TTgt, TSrc>
Returns
- TControl
Type Parameters
TControlTSourceTSrcTTgt
BindTwoWay<TBuilder, TControl, TSource, TValue>(TBuilder, TSource, Expression<Func<TSource, TValue>>, Expression<Func<TControl, TValue>>)
Creates a deferred two-way binding on a builder (same type).
public static TBuilder BindTwoWay<TBuilder, TControl, TSource, TValue>(this TBuilder builder, TSource source, Expression<Func<TSource, TValue>> sourceExpr, Expression<Func<TControl, TValue>> targetExpr) where TBuilder : IControlBuilder<TControl> where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
builderTBuildersourceTSourcesourceExprExpression<Func<TSource, TValue>>targetExprExpression<Func<TControl, TValue>>
Returns
- TBuilder
Type Parameters
TBuilderTControlTSourceTValue
BindTwoWay<TBuilder, TControl, TSource, TSrc, TTgt>(TBuilder, TSource, Expression<Func<TSource, TSrc>>, Expression<Func<TControl, TTgt>>, Func<TSrc, TTgt>, Func<TTgt, TSrc>)
Creates a deferred two-way binding on a builder with converters.
public static TBuilder BindTwoWay<TBuilder, TControl, TSource, TSrc, TTgt>(this TBuilder builder, TSource source, Expression<Func<TSource, TSrc>> sourceExpr, Expression<Func<TControl, TTgt>> targetExpr, Func<TSrc, TTgt> toTarget, Func<TTgt, TSrc> toSource) where TBuilder : IControlBuilder<TControl> where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
builderTBuildersourceTSourcesourceExprExpression<Func<TSource, TSrc>>targetExprExpression<Func<TControl, TTgt>>toTargetFunc<TSrc, TTgt>toSourceFunc<TTgt, TSrc>
Returns
- TBuilder
Type Parameters
TBuilderTControlTSourceTSrcTTgt
Bind<TControl, TSource, TValue>(TControl, TSource, Expression<Func<TSource, TValue>>, Expression<Func<TControl, TValue>>)
Creates a one-way binding from a source property to a control property (same type).
public static TControl Bind<TControl, TSource, TValue>(this TControl control, TSource source, Expression<Func<TSource, TValue>> sourceExpr, Expression<Func<TControl, TValue>> targetExpr) where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
controlTControlsourceTSourcesourceExprExpression<Func<TSource, TValue>>targetExprExpression<Func<TControl, TValue>>
Returns
- TControl
Type Parameters
TControlTSourceTValue
Bind<TControl, TSource, TSrc, TTgt>(TControl, TSource, Expression<Func<TSource, TSrc>>, Expression<Func<TControl, TTgt>>, Func<TSrc, TTgt>)
Creates a one-way binding from a source property to a control property with a converter.
public static TControl Bind<TControl, TSource, TSrc, TTgt>(this TControl control, TSource source, Expression<Func<TSource, TSrc>> sourceExpr, Expression<Func<TControl, TTgt>> targetExpr, Func<TSrc, TTgt> converter) where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
controlTControlsourceTSourcesourceExprExpression<Func<TSource, TSrc>>targetExprExpression<Func<TControl, TTgt>>converterFunc<TSrc, TTgt>
Returns
- TControl
Type Parameters
TControlTSourceTSrcTTgt
Bind<TBuilder, TControl, TSource, TValue>(TBuilder, TSource, Expression<Func<TSource, TValue>>, Expression<Func<TControl, TValue>>)
Creates a deferred one-way binding on a builder (same type).
public static TBuilder Bind<TBuilder, TControl, TSource, TValue>(this TBuilder builder, TSource source, Expression<Func<TSource, TValue>> sourceExpr, Expression<Func<TControl, TValue>> targetExpr) where TBuilder : IControlBuilder<TControl> where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
builderTBuildersourceTSourcesourceExprExpression<Func<TSource, TValue>>targetExprExpression<Func<TControl, TValue>>
Returns
- TBuilder
Type Parameters
TBuilderTControlTSourceTValue
Bind<TBuilder, TControl, TSource, TSrc, TTgt>(TBuilder, TSource, Expression<Func<TSource, TSrc>>, Expression<Func<TControl, TTgt>>, Func<TSrc, TTgt>)
Creates a deferred one-way binding on a builder with a converter.
public static TBuilder Bind<TBuilder, TControl, TSource, TSrc, TTgt>(this TBuilder builder, TSource source, Expression<Func<TSource, TSrc>> sourceExpr, Expression<Func<TControl, TTgt>> targetExpr, Func<TSrc, TTgt> converter) where TBuilder : IControlBuilder<TControl> where TControl : BaseControl where TSource : INotifyPropertyChanged
Parameters
builderTBuildersourceTSourcesourceExprExpression<Func<TSource, TSrc>>targetExprExpression<Func<TControl, TTgt>>converterFunc<TSrc, TTgt>
Returns
- TBuilder
Type Parameters
TBuilderTControlTSourceTSrcTTgt