Table of Contents

Event Accepted

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

Event raised when the View has been accepted. This is raised after Accepting has been raised and not cancelled.

public event EventHandler<CommandEventArgs>? Accepted

Returns

EventHandler<CommandEventArgs>
Event raised when the View has been accepted. This is raised after has been raised and not cancelled.

Remarks

Unlike Accepting, this event cannot be cancelled. It is raised after the View has been accepted.

See RaiseAccepted(ICommandContext?) for more information.

When to use: Subscribe to Accepted for fire-and-forget side-effects — things that happen after the accept has completed and cannot be cancelled. This is the right choice for the vast majority of button-click–style handlers.

Example:

button.Accepted += (_, _) => DoTheThing ();   // correct — side-effect only
button.Accepting += (_, e) => { if (!CanProceed ()) e.Handled = true; }; // correct — cancels
button.Accepting += (_, _) => DoTheThing (); // wrong — use Accepted instead