CommandAttribute.CanExecuteMethodName Property
Gets or sets the name of the function that defines whether the command can be executed.
Namespace: DevExpress.Mvvm.DataAnnotations
Assembly: DevExpress.Mvvm.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
String | A String value that is the function name. |
Remarks
The function specified via the CanExecuteMethodName property should return a bool value. The command can be executed only if this function returns true.
See the example below:
public class LoginViewModel {
[Command(CanExecuteMethodName = "CanSaveAccountSettings",
Name = "SaveCommand",
UseCommandManager = true)]
public void SaveAccountSettings(string fileName) {
//...
}
public bool CanSaveAccountSettings(string fileName) {
return !string.IsNullOrEmpty(fileName);
}
}
Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CanExecuteMethodName property.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.