0

Is CanExecuteChanged a event property of ICommand? If it's a property why does it have a add and remove instead of get , set?

If , it's not a property , then what is it?

 public event EventHandler CanExecuteChanged
        {
            add { CommandManager.RequerySuggested += value; }
            remove { CommandManager.RequerySuggested -= value; }
        }

And when does CanExecuteChanged gets fired?

Simsons
  • 12,295
  • 42
  • 153
  • 269
  • It's an event. Says so right there on the title. http://msdn.microsoft.com/en-us/library/system.windows.input.icommand.canexecutechanged.aspx – Jon Apr 04 '13 at 08:58
  • [MSDN](http://msdn.microsoft.com/en-us/library/bb882534.aspx) to the resque! – icebat Apr 04 '13 at 09:00
  • 1
    No it is not. It is an event. See this: http://stackoverflow.com/questions/6634777/what-is-the-actual-task-of-canexecutechanged-and-commandmanager-requerysuggested and also: http://stackoverflow.com/questions/4531360/what-is-canexecutechanged-for – Zoman Apr 04 '13 at 09:01
  • its an event and it need some add and remove listners. that why we have this property. – JSJ Apr 04 '13 at 10:13

2 Answers2

1

CanExecuteChanged is an event as indicated by the key word. You can read something about it here. The syntax of its accessor declaration is only similar to the implementation of a property.

DHN
  • 4,807
  • 3
  • 31
  • 45
0

It is an Event and does get fired if CanExecute method changes.

There are other questions here on SO like this and this that might be interesting for you.

Community
  • 1
  • 1
roqz
  • 1,020
  • 6
  • 17