Skip to content

WindowActionContext

Namespace: Hex1b

Assembly: Hex1b.dll

Provides context for window title bar action callbacks.

csharp
public sealed class WindowActionContext : WidgetEventArgs

Inheritance

ObjectWidgetEventArgsWindowActionContext

Properties

Window

The window that owns this action.

Returns: WindowEntry

csharp
public WindowEntry Window { get; }

Methods

Cancel()

Closes this window without a result, signaling cancellation. Alias for - for dialogs with OnResult, the callback receives IsCancelled = true.

csharp
public void Cancel()

Close()

Closes this window. For dialogs with OnResult, this signals cancellation (IsCancelled = true).

csharp
public void Close()

CloseWithResult<TResult>(TResult)

Closes this window with a result value (for modal dialogs).

Parameters:

  • result (<TResult>): The result value.
csharp
public void CloseWithResult<TResult>(TResult result)

Remarks

This context is passed to action handlers (like close, custom actions) when a title bar button is clicked, allowing the handler to interact with the window and access app-level services.

WindowActionContext extends , providing access to:

  • The window manager for opening other windows - The popup stack for menus and dialogs - The notification stack for user feedback - For async operations

Examples

csharp
new WindowAction("📌", ctx => {
    ctx.Notifications.Post(new Notification("Pinned", "Window has been pinned"));
})

Released under the MIT License.