1
Vote

UIElementCommandAdapter malfunction

description

If a command invoker is added for a disabled command, the UIElement appears enabled. This is beacuase UIElementCommandAdapter does not overrides BindCommand method.
 
This is my suggested code:
 
    public override void BindCommand(Command command)
    {
        base.BindCommand(command);
        foreach (UIElement key in Invokers.Keys)
        {
            key.IsEnabled = (command.Status == CommandStatus.Enabled);
            key.Visibility = (command.Status == CommandStatus.Unavailable) ? Visibility.Collapsed : Visibility.Visible;
        }
    }

comments