Skip to main content

CommandAttribute.UseCommandManager Property

Gets or sets whether to use a function that manages the command execution.

Namespace: DevExpress.Mvvm.DataAnnotations

Assembly: DevExpress.Mvvm.v24.1.dll

NuGet Packages: DevExpress.Mvvm, DevExpress.Win.Navigation

Declaration

public bool UseCommandManager { get; set; }

Property Value

Type Description
Boolean

true to use the command manager; otherwise, false.

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);
    }
}
See Also