CommandCreatePropertyChangedHandlerBinding(INotifyPropertyChanged, ActionString, String) Method

Creates a special command binding for the PropertyChanged event of the specified source that invokes the specified handler only when the changed property is among the specified propertyNames.

Definition

Namespace: KGySoft.ComponentModel
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
C#
public static ICommandBinding CreatePropertyChangedHandlerBinding(
	this INotifyPropertyChanged source,
	Action<string> handler,
	params string[] propertyNames
)

Parameters

source  INotifyPropertyChanged
The source object, whose PropertyChanged event is observed.
handler  ActionString
The delegate to be invoked when the changed property is among the specified propertyNames. Its parameter is the name of the changed property.
propertyNames  String
The property names, whose change invoke the specified handler.

Return Value

ICommandBinding
The created ICommandBinding instance.

Usage Note

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

Exceptions

ArgumentNullExceptionsource or propertyNames is .
ArgumentExceptionpropertyNames is empty.

See Also