CommandCreateTwoWayPropertyBinding(INotifyPropertyChanged, String, INotifyPropertyChanged, String, FuncObject, Object, FuncObject, Object) Method
Creates a pair of special bindings for the
PropertyChanged 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: 9.0.0
public static ICommandBinding[] CreateTwoWayPropertyBinding(
this INotifyPropertyChanged source,
string sourcePropertyName,
INotifyPropertyChanged target,
string? targetPropertyName = null,
Func<Object?, Object?>? format = null,
Func<Object?, Object?>? parse = null
)
<ExtensionAttribute>
Public Shared Function CreateTwoWayPropertyBinding (
source As INotifyPropertyChanged,
sourcePropertyName As String,
target As INotifyPropertyChanged,
Optional targetPropertyName As String = Nothing,
Optional format As Func(Of Object, Object) = Nothing,
Optional parse As Func(Of Object, Object) = Nothing
) As ICommandBinding()
public:
[ExtensionAttribute]
static array<ICommandBinding^>^ CreateTwoWayPropertyBinding(
INotifyPropertyChanged^ source,
String^ sourcePropertyName,
INotifyPropertyChanged^ target,
String^ targetPropertyName = nullptr,
Func<Object^, Object^>^ format = nullptr,
Func<Object^, Object^>^ parse = nullptr
)
[<ExtensionAttribute>]
static member CreateTwoWayPropertyBinding :
source : INotifyPropertyChanged *
sourcePropertyName : string *
target : INotifyPropertyChanged *
?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 INotifyPropertyChanged
- 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 INotifyPropertyChanged
- 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.In Visual Basic and C#, you can call this method as an instance method on any object of type
INotifyPropertyChanged. 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).