Table of Contents

Class Dialog<TResult>

Namespace
Icy.UI.Controls
Assembly
IcyUI.dll

A Dialog paired with a Task<TResult>-returning show/close API - the general-purpose modal-hosting primitive most callers use directly (or through MessageBox's convenience methods). Not a UIElement itself; wraps a plain Dialog instance, which is what's actually added to a Canvas and themed - a closed generic type's runtime name embeds its type argument, so an open-generic Style TargetType="Dialog" entry would never match a Dialog<TResult> if it were a UIElement itself.

public sealed class Dialog<TResult>

Type Parameters

TResult

The type of value this dialog closes with.

Inheritance
Dialog<TResult>
Inherited Members
Extension Methods

Constructors

Dialog()

Initializes a new instance of the Dialog<TResult> class.

public Dialog()

Properties

Content

Gets or sets the content this dialog displays.

public UIElement? Content { get; set; }

Property Value

UIElement

IsOpen

Gets a value indicating whether this dialog is currently shown.

public bool IsOpen { get; }

Property Value

bool

Methods

Close(TResult?)

Closes this dialog with result, completing the task ShowAsync(Canvas) returned. A no-op if this dialog isn't currently open.

public void Close(TResult? result)

Parameters

result TResult

The result to complete the ShowAsync(Canvas) task with.

ShowAsync(Canvas)

Shows this dialog as a modal overlay on canvas and returns a task that completes with whatever value Close(TResult?) is called with (or default, if dismissed via Escape). Calling this again while already open returns the same in-flight task instead of showing a second copy.

public Task<TResult?> ShowAsync(Canvas canvas)

Parameters

canvas Canvas

The canvas to show this dialog on.

Returns

Task<TResult>

A task that completes with the dialog's result once it closes.