CommandCreateTwoWayPropertyBinding(Object, String, Object, String, FuncObject, Object, FuncObject, Object) Method
Creates a pair of special bindings for the
PropertyChanged or
sourcePropertyNameChanged event of the specified
source
and
target, which allow to update the specified
targetPropertyName and
sourcePropertyName in both directions when any of them changes.
Namespace: KGySoft.ComponentModelAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
public static ICommandBinding[] CreateTwoWayPropertyBinding(
Object source,
string sourcePropertyName,
Object target,
string? targetPropertyName = null,
Func<Object?, Object?>? format = null,
Func<Object?, Object?>? parse = null
)
Public Shared Function CreateTwoWayPropertyBinding (
source As Object,
sourcePropertyName As String,
target As Object,
Optional targetPropertyName As String = Nothing,
Optional format As Func(Of Object, Object) = Nothing,
Optional parse As Func(Of Object, Object) = Nothing
) As ICommandBinding()
public:
static array<ICommandBinding^>^ CreateTwoWayPropertyBinding(
Object^ source,
String^ sourcePropertyName,
Object^ target,
String^ targetPropertyName = nullptr,
Func<Object^, Object^>^ format = nullptr,
Func<Object^, Object^>^ parse = nullptr
)
static member CreateTwoWayPropertyBinding :
source : Object *
sourcePropertyName : string *
target : Object *
?targetPropertyName : string *
?format : Func<Object, Object> *
?parse : Func<Object, Object>
(* Defaults:
let _targetPropertyName = defaultArg targetPropertyName null
let _format = defaultArg format null
let _parse = defaultArg parse null
*)
-> ICommandBinding[]
- source Object
- The source object, whose property specified by the sourcePropertyName parameter is observed.
- sourcePropertyName String
- The name of the source property, whose change is observed.
- target Object
- The target object, whose property specified by the targetPropertyName parameter is observed.
- targetPropertyName String (Optional)
- The name of the target property, whose change is observed. If ,
then it is considered as the same as sourcePropertyName. This parameter is optional.
Default value: . - format FuncObject, Object (Optional)
- If not , then can be used to format the value to be set in the target object. This parameter is optional.
Default value: . - parse FuncObject, Object (Optional)
- If not , then can be used to parse the value to be set in the source object. This parameter is optional.
Default value: .
ICommandBindingThe created pair of
ICommandBinding instances.