Skip to content

API Binding

Thomas Baker edited this page Apr 23, 2022 · 1 revision

BindingExtensions

public static class BindingExtensions

Summary

Members

Binding

public static TControl Binding<TSource, TSourceProp, TControl, TTargetProp>(this TControl control, 
    TSource source, Expression<Func<TSource, TSourceProp>> sourceProp, 
    Expression<Func<TControl, TTargetProp>> targetProp, 
    Func<TSourceProp, TTargetProp>? convert = null, 
    Func<TTargetProp, TSourceProp>? convertBack = null)
    where TControl : Control

Sets up a Binding for a Control.DataBindings collection, and returns a reference to the control.

UpdateMode is OnPropertyChanged, formattingEnabled=false

Parameters

Name Summary
control Target of the data binding
source Source of the data binding
sourceProp A lambda expression accessing the source property (path derived through reflection and can be
several levels deep)
targetProp A lambda expression accessing the direct target property (must be a member accessor).
convert If present, hooks the Binding.Format event.
convertBack If present, hooks the Binding.Parse event.

See Also

  • public class Control : Component
  • public class Expression : LambdaExpression
  • public class Expression : LambdaExpression
  • public delegate TSourceProp Func(TSource arg);
  • public delegate TTargetProp Func(TControl arg);
  • public delegate TTargetProp Func(TSourceProp arg);
  • public delegate TSourceProp Func(TTargetProp arg);
  • public class TControl : Control
  • public class TSource
  • public class TSourceProp
  • public class TTargetProp

Binding

public static TControl Binding<TSource, TSourceProp, TControl>(this TControl control, 
    TSource source, Expression<Func<TSource, TSourceProp>> sourceProp)
    where TControl : Control

Sets up a Binding to the Control.Text property, and returns a reference to the control.

UpdateMode is OnPropertyChanged, formattingEnabled=false

Parameters

Name Summary
control
source Source of the data binding
sourceProp A lambda expression accessing the source property (path derived through reflection and can be
several levels deep)

See Also

  • public class Control : Component
  • public class Expression : LambdaExpression
  • public delegate TSourceProp Func(TSource arg);
  • public class TControl : Control
  • public class TSource
  • public class TSourceProp

Binding

public static TControl Binding<TSource, TSourceProp, TControl, TTargetProp>(this TControl control, 
    TSource source, string sourceProp, string targetProp = "Text", 
    Func<TSourceProp, TTargetProp>? convert = null, 
    Func<TTargetProp, TSourceProp>? convertBack = null)
    where TControl : Control

Sets up a Binding for a Control.DataBindings collection, and returns a reference to the control.

UpdateMode is OnPropertyChanged, formattingEnabled=false

Parameters

Name Summary
control Target of the data binding
source Source of the data binding
sourceProp Data binding path on source
targetProp Data binding path on target (default to "Text")
convert If present, hooks the Binding.Format event.
convertBack If present, hooks the Binding.Parse event.

See Also

  • public class Control : Component
  • public delegate TTargetProp Func(TSourceProp arg);
  • public delegate TSourceProp Func(TTargetProp arg);
  • public class TControl : Control
  • public class TSource
  • public class TSourceProp
  • public class TTargetProp