-
Notifications
You must be signed in to change notification settings - Fork 2
API Binding
Thomas Baker edited this page Apr 23, 2022
·
1 revision
public static class BindingExtensions
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
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. |
- 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
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
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) |
- public class Control : Component
- public class Expression : LambdaExpression
- public delegate TSourceProp Func(TSource arg);
- public class TControl : Control
- public class TSource
- public class TSourceProp
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
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. |
- 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