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.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
C#
public static ICommandBinding[] CreateTwoWayPropertyBinding(
	Object source,
	string sourcePropertyName,
	Object target,
	string? targetPropertyName = null,
	Func<Object?, Object?>? format = null,
	Func<Object?, Object?>? parse = null
)

Parameters

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: .

Return Value

ICommandBinding
The created pair of ICommandBinding instances.

Exceptions

ArgumentNullExceptionsource, sourcePropertyName or target is .
ArgumentExceptionsource or target is neither an INotifyPropertyChanged implementation nor has a sourcePropertyNameChanged event.

See Also