Timeline for Usefulness of the Command CanExecute as it exists in WPF
Current License: CC BY-SA 3.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 9, 2019 at 20:31 | comment | added | KolA | In theory, different controls that bind to a command may have a custom appearance when command can't be executed, e.g. become invisible instead disabled/greyed out or something more fancy. With ICommand.CanExecute you don't need to think about it | |
| Feb 23, 2016 at 9:55 | comment | added | Peter Duniho | The only advantage that seems real to me is that the method can accept a parameter, but that's never mentioned in the answer above (nor have I found anyone bring that up as a key argument in favor of the CanExecute() method) | |
| Feb 23, 2016 at 9:54 | comment | added | Peter Duniho | I am curious about the question as well. For me, the main question is why have CanExecute() as a method, instead of an observable property? 2 bindings aren't required...the property could just be in ICommand and so assumed just as CanExecute() is now. Likewise, a property can still be associated with an event (e.g. CanExecuteChanged, PropertyChanged, etc.) to support notification. And CommandManager could just as easily call a property getter as call the CanExecute() method. | |
| Sep 18, 2015 at 8:04 | comment | added | Sjoerd222888 | Ok, I meant UI libraries that provide CanExecute. I used the term MVVM because WPF and the other libraries form theris design are very suited for MVVM and most applications get developed in MVVM. It is the prefered pattern for WPF but of course you can also do MVC. | |
| Sep 17, 2015 at 14:32 | comment | added | 17 of 26 | Your question doesn't make sense. Those things you listed aren't MVVM frameworks. | |
| Sep 17, 2015 at 8:52 | comment | added | Sjoerd222888 | What MVVM frameworks other than WPF, Windows Store Apps and Windows Phone Apps do provide CanExecute? I thought it where only the M$ MVVM libs that have CanExecute. | |
| Sep 16, 2015 at 14:16 | history | answered | 17 of 26 | CC BY-SA 3.0 |