Why "NotifyCanExecuteChangedFor" didn't fire? #552
-
|
Hello! Currently I'm playing around with the CommunityToolkit for .Net MAUI and DevExpress Controls for .Net MAUI. In my LoginViewModel I'm using the following code snippets: I've a class for saving mailadress and password of the user like this: In my ViewModel I've got a property of this class which also manage the execution of a command: And now the implementation of the command: ValidateLoginData checks the user input: Mail and passwort are inserted by user via GUI and are stored in Email and Passwort Property of LoginModel but [NotifyCanExecuteChangedFor] isn't called at all! Could someone please get me some help? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
|
cc: @Sergio0694 |
Beta Was this translation helpful? Give feedback.
-
|
This is by design. Unrelated: you don't need that |
Beta Was this translation helpful? Give feedback.
This is by design.
[NotifyCanExecuteChangeFor]will notify the command when the annotated property (field) changes. In your case that's not what's happening: you're changing a property inside an object that's assigned to the property. But the value of the property itself is not changing — it's still the same object.Unrelated: you don't need that
IsBusyboilerplate code and additional property within the command, just bind to theIsRunningproperty of the generated async relay command, that'll do all of that automatically for you 🙂