Table of Contents

Method TryBubbleUp

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

TryBubbleUp(ICommandContext?, bool)

Bubbles a command to the SuperView if the command is in SuperView's CommandsToBubbleUp list. Handles the special case of invoking Accept on a peer IsDefault button.

protected bool? TryBubbleUp(ICommandContext? ctx, bool handled)

Parameters

ctx ICommandContext

The command context to pass along.

handled bool

Whether the command was already handled by this View.

Returns

bool?

true if the command was already handled locally. false if the command was not handled (including after a successful bubble).

Remarks

Bubbling is a notification, not a consumption. The SuperView's handler is invoked, but its return value is ignored — this method always returns false after a successful bubble. This ensures the originating view can complete its own processing (e.g., a CheckBox can toggle, a Shortcut can raise Activated) without being blocked by the SuperView returning true.

To cancel a SubView's command, subscribe to the SubView's Activating/Accepting event and set Handled = true — that guard runs before TryBubbleUp(ICommandContext?, bool) is called.