Table of Contents

Method GetDispatchTarget

Namespace
Terminal.Gui.ViewBase
Assembly
Terminal.Gui.dll

GetDispatchTarget(ICommandContext?)

Gets the SubView to dispatch commands to. Return null to skip dispatch. The framework calls this during RaiseActivating(ICommandContext?)/RaiseAccepting(ICommandContext?) after the OnActivating virtual and OnAccepting event have had a chance to cancel.

protected virtual View? GetDispatchTarget(ICommandContext? ctx)

Parameters

ctx ICommandContext

The command context.

Returns

View

The SubView to dispatch to, or null to skip dispatch.

Remarks

Override this in composite views that delegate commands to a primary SubView. For example, Shortcut returns CommandView and selectors return Focused.

The framework guards against dispatch when:

<ul><li>Routing is <xref href="Terminal.Gui.Input.CommandRouting.DispatchingDown" data-throw-if-not-resolved="false"></xref> (prevents re-entry)</li><li>No binding exists on the context (programmatic invocation — skip dispatch)</li><li>The binding source is within the target (prevents loops)</li></ul>