public sealed class CommandResponderA table of command handlers, owned by something that is not an element.
Remarks
What a view-model, a document object or an application delegate uses. Before this, a handler had to hang on a UiElement, so an object that owned edit.copy had to own a piece of the view tree in order to say so — which is backwards for the one kind of object whose whole job is not to be a view.
It is deliberately the same five arguments as AddCommandHandler, with the same rule about a repeated id, so that moving a handler between an element and a responder is a change of receiver and nothing else.
⚠ It does not invalidate anything, because it does not know a document. An element registering a handler can raise CommandsInvalidated because it is in a document; a responder may be installed on several or on none. The owner calls InvalidateCommands after changing the table — installing the responder in the first place already does.
Fields and properties (1)
public IEnumerable<string> IdsThe ids this responder handles.
Methods (4)
public void Add(string id, Action execute, Func<bool>? canExecute = null, Func<string?>? title = null, Func<bool>? isChecked = null)Declares that this responder handles a command.
public bool Remove(string id)Stops handling a command.
public void Clear()Drops every handler.
public bool TryGetCommandHandler(string id, out CommandHandler handler)The handler this responder has for a command id, if it has one.
Used by (2)
- ShellHelloUi
- CommandResponderTestsVixen.Ui.Tests