corelibraries-devexpress-dot-mvvm-dot-dataannotations-dot-commandattribute-3aa69d64.md
Gets or sets whether to use a function that manages the command execution. This property applies to WPF projects.
Namespace : DevExpress.Mvvm.DataAnnotations
Assembly : DevExpress.Mvvm.v25.2.dll
NuGet Packages : DevExpress.Mvvm, DevExpress.Win.Navigation
public bool UseCommandManager { get; set; }
Public Property UseCommandManager As Boolean
| Type | Description |
|---|---|
| Boolean |
true to use the command manager; otherwise, false.
|
The UseCommandManager property specifies whether the Command attribute uses the CommandManager to raise the CanExecuteChanged event.
If you set the UseCommandManager property to true, a CanExecute function is triggered each time a user interacts with the application UI. Otherwise, you should call the RaiseCanExecuteChanged method to update your command.
public class LoginViewModel {
[Command(CanExecuteMethodName = "CanSaveAccountSettings",
Name = "SaveCommand",
UseCommandManager = true)]
public void SaveAccountSettings(string fileName) {
//...
}
public bool CanSaveAccountSettings(string fileName) {
return !string.IsNullOrEmpty(fileName);
}
}
Warning
The CommandAttribute.UseCommandManager property has no effect in DevExpress WinForms MVVM applications. In WinForms apps, call the RaiseCanExecuteChanged method to update the command.
See Also