public static ICommandBinding CreatePropertyBinding(
this INotifyPropertyChanged source,
string sourcePropertyName,
string targetPropertyName,
params Object[]? targets
)
<ExtensionAttribute>
Public Shared Function CreatePropertyBinding (
source As INotifyPropertyChanged,
sourcePropertyName As String,
targetPropertyName As String,
ParamArray targets As Object()
) As ICommandBinding
public:
[ExtensionAttribute]
static ICommandBinding^ CreatePropertyBinding(
INotifyPropertyChanged^ source,
String^ sourcePropertyName,
String^ targetPropertyName,
... array<Object^>^ targets
)
[<ExtensionAttribute>]
static member CreatePropertyBinding :
source : INotifyPropertyChanged *
sourcePropertyName : string *
targetPropertyName : string *
targets : Object[] -> ICommandBinding
This method uses a prepared command internally, which is bound to the PropertyChanged event of the specified source object.
The ICommandState, which is created for the underlying command contains the specified property names. Do not remove these state entries; otherwise, the command will throw an InvalidOperationException when executed.
The property with targetPropertyName will be set in the specified targets immediately when this method is called. The targets, which are added later by the ICommandBinding.AddTarget methods, are set only when the PropertyChanged event occurs on the source object.
ArgumentNullException | source, sourcePropertyName or targetPropertyName is . |