CommandAttribute.UseCommandManager Property
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
Declaration
Property Value
| Type | Description |
|---|---|
| Boolean |
|
Remarks
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.