Click or drag to resize

BindableBindingT, TValueBindDataContextTObject Method (FuncTObject, TValue, ActionTObject, TValue, ActionTObject, EventHandlerEventArgs, ActionTObject, EventHandlerEventArgs, DualBindingMode, TValue, TValue)

Binds to a control's DataContext using delegates to get/set the value.

Namespace:  Eto.Forms
Assembly:  Eto (in Eto.dll) Version: 2.5.3-dev
Syntax
public DualBinding<TValue> BindDataContext<TObject>(
	Func<TObject, TValue> getValue,
	Action<TObject, TValue> setValue,
	Action<TObject, EventHandler<EventArgs>> addChangeEvent = null,
	Action<TObject, EventHandler<EventArgs>> removeChangeEvent = null,
	DualBindingMode mode = DualBindingMode.TwoWay,
	TValue defaultGetValue = null,
	TValue defaultSetValue = null
)

Parameters

getValue
Type: SystemFuncTObject, TValue
Delegate to get the value from the data context.
setValue
Type: SystemActionTObject, TValue
Delegate to set the value to the data context when changed.
addChangeEvent (Optional)
Type: SystemActionTObject, EventHandlerEventArgs
Delegate to add a change event on the data context.
removeChangeEvent (Optional)
Type: SystemActionTObject, EventHandlerEventArgs
Delegate to remove the change event from the data context.
mode (Optional)
Type: Eto.FormsDualBindingMode
Dual binding mode.
defaultGetValue (Optional)
Type: TValue
Default get value.
defaultSetValue (Optional)
Type: TValue
Default set value.

Type Parameters

TObject
Type of the data context object to bind with.

Return Value

Type: DualBindingTValue
A new dual binding that binds the control to this object binding.
Remarks
This is a shortcut to use the DelegateBindingT, TValue to bind to a control's DataContext property. When the data context type is TValue, then the delegates will be called to get/set the value. Otherwise, if the data context is null or a different type, the defaultGetValue will be used.
See Also