Table of Contents

Struct CommandContext

Namespace
Terminal.Gui.Input
Assembly
Terminal.Gui.dll

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.

Command

The Command that is being invoked.

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).

Methods

Equals(object)
Equals(CommandContext)
GetHashCode()
ToString()

Operators

operator ==(CommandContext, CommandContext)
operator !=(CommandContext, CommandContext)

See Also