public ICommandBinding AddPropertyBinding(
Object source,
string sourcePropertyName,
string targetPropertyName,
Func<Object?, Object?>? format,
params Object[] targets
)
Public Function AddPropertyBinding (
source As Object,
sourcePropertyName As String,
targetPropertyName As String,
format As Func(Of Object, Object),
ParamArray targets As Object()
) As ICommandBinding
public:
ICommandBinding^ AddPropertyBinding(
Object^ source,
String^ sourcePropertyName,
String^ targetPropertyName,
Func<Object^, Object^>^ format,
... array<Object^>^ targets
)
member AddPropertyBinding :
source : Object *
sourcePropertyName : string *
targetPropertyName : string *
format : Func<Object, Object> *
targets : Object[] -> ICommandBinding
This method uses a prepared command internally, which is bound to the PropertyChanged event of the specified source object. Or, when source does not implement INotifyPropertyChanged, then an event of name sourcePropertyName postfixed by Changed should exist on the source object.
The ICommandState, which is created for the underlying command contains the specified property names and formatparameters. 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 or sourcePropertyNameChanged event occurs on the source object.
ArgumentNullException | source, sourcePropertyName or targetPropertyName is . |
ArgumentException | source is neither an INotifyPropertyChanged implementation nor has a sourcePropertyNameChanged event. |