BindableExtensionsBindDataContextT Method (IBindable, String, String, DualBindingMode, T, T) |
Adds a new binding with the control and the the control's current data context
Namespace:
Eto.Forms
Assembly:
Eto (in Eto.dll) Version: 2.5.3-dev
Syntax public static DualBinding<T> BindDataContext<T>(
this IBindable bindable,
string controlPropertyName,
string dataContextPropertyName,
DualBindingMode mode = DualBindingMode.TwoWay,
T defaultControlValue = null,
T defaultContextValue = null
)
<ExtensionAttribute>
Public Shared Function BindDataContext(Of T) (
bindable As IBindable,
controlPropertyName As String,
dataContextPropertyName As String,
Optional mode As DualBindingMode = DualBindingMode.TwoWay,
Optional defaultControlValue As T = Nothing,
Optional defaultContextValue As T = Nothing
) As DualBinding(Of T)
[<ExtensionAttribute>]
static member BindDataContext :
bindable : IBindable *
controlPropertyName : string *
dataContextPropertyName : string *
?mode : DualBindingMode *
?defaultControlValue : 'T *
?defaultContextValue : 'T
(* Defaults:
let _mode = defaultArg mode DualBindingMode.TwoWay
let _defaultControlValue = defaultArg defaultControlValue null
let _defaultContextValue = defaultArg defaultContextValue null
*)
-> DualBinding<'T>
Parameters
- bindable
- Type: Eto.FormsIBindable
Bindable object to add the binding to - controlPropertyName
- Type: SystemString
Property on the control to update - dataContextPropertyName
- Type: SystemString
Property on the control's DataContext to bind to the control - mode (Optional)
- Type: Eto.FormsDualBindingMode
Mode of the binding - defaultControlValue (Optional)
- Type: T
Default value to set to the control when the value from the DataContext is null - defaultContextValue (Optional)
- Type: T
Default value to set to the DataContext property when the control value is null
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:Eto.Forms.BindableExtensions.BindDataContext``1(Eto.Forms.IBindable,System.String,System.String,Eto.Forms.DualBindingMode,``0,``0)"]
Return Value
Type:
DualBindingTA new instance of the DualBinding class that is used to control the binding
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
IBindable. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
Remarks
This binds to a property of the
DataContext, which will return the topmost value
up the control hierarchy. For example, you can set the DataContext of your form or panel, and then bind to properties
of that context on any of the child controls such as a text box, etc.
See Also