-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setting 'CanExecute' doesn't change the status of Button controls when they are bound to RelayCommand #874
Comments
I think you'll need to call the
|
That has no effect, the breakpoint on CanExecuteMyCommand() is never hit until the user clicks on the button. So the buttons always appear enabled even though IsEnabled is false. However, doing this does fix it => [ObservableProperty] [RelayCommand(CanExecute = nameof(CanExecuteMyCommand))] so there must be something else missing here |
Using |
@JoshStrauss As you have fixed the problem, you can close it. |
Setting 'CanExecute' doesn't change the status of Button controls when they are bound to RelayCommand. I recently upgraded from GalaSoft.MvvmLight.Command.RelayCommand where this was possible. However, using the RelayCommand in the tool kit doesn't enable and disable buttons consistently in the UI.
I've manually copied this class back into the solution and it fixes the problem.
https://github.com/lbugnion/mvvmlight/blob/aa657f7150730ea9d82d1077ffa0038affc400ca/V3/GalaSoft.MvvmLight/GalaSoft.MvvmLight%20(NET35)/Command/RelayCommand.cs#L4
Regression
No response
Steps to reproduce
Expected behavior
If can canExecute is false button to become disabled
Screenshots
No response
IDE and version
VS 2022
IDE version
No response
Nuget packages
Nuget package version(s)
8.2.2
Additional context
No response
Help us help you
Yes, I'd like to be assigned to work on this item
The text was updated successfully, but these errors were encountered: