Struct CommandContext
Provides context for a Command invocation.
public struct CommandContext : ICommandContext, IEquatable<CommandContext>
- Implements
- Inherited Members
Remarks
Use pattern matching to access specific binding types:
if (ctx.Binding is KeyBinding kb) { /* key input */ }
else if (ctx.Binding is MouseBinding mb) { /* mouse input */ }
else if (ctx.Binding is InputBinding ib) { /* programmatic */ }
Constructors
- CommandContext(Command, View?, IInputBinding?)
Initializes a new instance with the specified Command.
Properties
- Binding
The binding that triggered the command.
- Source
The View that was the source of the command invocation, if any. (e.g. the view the user clicked on or the view that had focus when a key was pressed).