CanExecute part of a command is not called in all cases. what does determine it?
-
28-05-2021 - |
Question
In my WPF application using MVVM I noticed that in some cases the CanExecute part of a Command is not called, so I was wondering what decides when this (kind of) method is called?
La solution
CanExecute
is called by a control when it is told by raising the CanExecuteChanged
event, how exactly controls handle Commands
is up to them (they could for example also call it again when the CommandParameter
changes), but if you want them to reevaluate CanExecute
you should fire the event manually.
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow