public static ICommandBinding CreateSynchronizedPropertyBinding(
Object source,
string sourcePropertyName,
string targetPropertyName,
bool awaitCompletion,
params Object[]? targets
)
Public Shared Function CreateSynchronizedPropertyBinding (
source As Object,
sourcePropertyName As String,
targetPropertyName As String,
awaitCompletion As Boolean,
ParamArray targets As Object()
) As ICommandBinding
public:
static ICommandBinding^ CreateSynchronizedPropertyBinding(
Object^ source,
String^ sourcePropertyName,
String^ targetPropertyName,
bool awaitCompletion,
... array<Object^>^ targets
)
static member CreateSynchronizedPropertyBinding :
source : Object *
sourcePropertyName : string *
targetPropertyName : string *
awaitCompletion : bool *
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. 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. |