Why people use CommandManager.InvalidateRequerySuggested() on ICommands?

后端 未结 4 1049
悲哀的现实
悲哀的现实 2021-02-20 17:23

I am making some custom ICommand implementation of my own and I see A LOT of implementations going like this:

public event EventHandler CanExecuteChanged
{
    a         


        
4条回答
  •  广开言路
    2021-02-20 17:40

    Why all the examples on the web don't implement something as simple as this? Am I missing something?

    I'm guessing it's mostly due to laziness... What you propose is indeed a better (more efficient) implementation. However, it's not complete: you still need to subscribe to CommandManager.RequerySuggested to raise CanExecuteChanged on the command.

提交回复
热议问题