Table of Contents

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

control TControl
source TSource
sourceExpr Expression<Func<TSource, TValue>>
targetExpr Expression<Func<TControl, TValue>>

Returns

TControl

Type Parameters

TControl
TSource
TValue

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

control TControl
source TSource
sourceExpr Expression<Func<TSource, TSrc>>
targetExpr Expression<Func<TControl, TTgt>>
toTarget Func<TSrc, TTgt>
toSource Func<TTgt, TSrc>

Returns

TControl

Type Parameters

TControl
TSource
TSrc
TTgt

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

builder TBuilder
source TSource
sourceExpr Expression<Func<TSource, TValue>>
targetExpr Expression<Func<TControl, TValue>>

Returns

TBuilder

Type Parameters

TBuilder
TControl
TSource
TValue

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

builder TBuilder
source TSource
sourceExpr Expression<Func<TSource, TSrc>>
targetExpr Expression<Func<TControl, TTgt>>
toTarget Func<TSrc, TTgt>
toSource Func<TTgt, TSrc>

Returns

TBuilder

Type Parameters

TBuilder
TControl
TSource
TSrc
TTgt

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

control TControl
source TSource
sourceExpr Expression<Func<TSource, TValue>>
targetExpr Expression<Func<TControl, TValue>>

Returns

TControl

Type Parameters

TControl
TSource
TValue

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

control TControl
source TSource
sourceExpr Expression<Func<TSource, TSrc>>
targetExpr Expression<Func<TControl, TTgt>>
converter Func<TSrc, TTgt>

Returns

TControl

Type Parameters

TControl
TSource
TSrc
TTgt

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

builder TBuilder
source TSource
sourceExpr Expression<Func<TSource, TValue>>
targetExpr Expression<Func<TControl, TValue>>

Returns

TBuilder

Type Parameters

TBuilder
TControl
TSource
TValue

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

builder TBuilder
source TSource
sourceExpr Expression<Func<TSource, TSrc>>
targetExpr Expression<Func<TControl, TTgt>>
converter Func<TSrc, TTgt>

Returns

TBuilder

Type Parameters

TBuilder
TControl
TSource
TSrc
TTgt