WPF Commands vs Events Advantages/Disadvantages

Commands provide two main benefits over event handlers:

  1. commands are not linked to the
    caller, so same command is not
    dependent and can be called from
    menu item, toolbar button, keyboard,
    etc.
  2. commands provide support for
    enabling/disabling all related UI
    controls based on the status of
    command (can be executed or not)

I’d prefer using commands at real project, especially if you want to use M-V-VM.

I haven’t heard about any memory leaks related with commands.

Events are probably faster, but the difference should not be significant – I’ve been using commands on my projects for 2 years and hadn’t any performance issues with them.

For more details on commands see Commanding Overview(archive)(v4)

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)