I would like to know how best to implement the following feature. Suppose some application has a menu. When creating an application, this menu is created. Each MenuItem contains a specific command. When executing any command, some MenuItem must be dizable. Conversely, when executing another command, be available for execution. How best to implement this behavior? I see several options:

  1. Run a bunch. That is, make the IsEnabled property dependent. Each time the target property changes, the dependent property changes (I personally understand the binding mechanism)
  2. Create a MenuItemAccessChanged event that, in the processing of which, forcibly updates all menu items

    1 answer 1

    This is best implemented through teams.

    When you bind MenuItem 's to a command, its enabled / disabled state is automatically attached to the CanExecute your command.

    Thus, you can disable the rest for the duration of the execution of one command, and then switch it back, simply by exposing this property to your ICommand implementation.

    • Yes, this is a great approach, thanks. - LmTinyToon
    • @LmTinyToon: Please! - VladD