Table of Contents

Interface ITwDialogReference

Namespace
TwBlazor.Services
Assembly
TwBlazor.dll

A handle to an active dialog instance shown via ITwDialogService.

public interface ITwDialogReference

Properties

Dialog

Gets the dialog content component instance, once rendered.

object? Dialog { get; }

Property Value

object

Id

Gets the unique identifier of this dialog.

Guid Id { get; }

Property Value

Guid

Options

Gets the options used to display this dialog.

TwDialogOptions? Options { get; }

Property Value

TwDialogOptions

RenderCompleteTaskCompletionSource

Gets a task source that completes once the dialog has rendered for the first time.

TaskCompletionSource<bool> RenderCompleteTaskCompletionSource { get; }

Property Value

TaskCompletionSource<bool>

RenderFragment

Gets or sets the rendered content of the dialog.

RenderFragment? RenderFragment { get; set; }

Property Value

RenderFragment

Result

Gets a task that completes with the result once the dialog closes.

Task<TwDialogResult?> Result { get; }

Property Value

Task<TwDialogResult>

Title

Gets the title displayed in the dialog header.

string? Title { get; }

Property Value

string

Methods

Close()

Closes the dialog with a successful, empty result.

void Close()

Close(TwDialogResult?)

Closes the dialog with the specified result.

void Close(TwDialogResult? result)

Parameters

result TwDialogResult

The result to complete Result with.

Dismiss(TwDialogResult?)

Marks the dialog as dismissed, completing Result.

bool Dismiss(TwDialogResult? result)

Parameters

result TwDialogResult

The result to complete Result with.

Returns

bool

true if this call set the result; false if it was already set.

GetReturnValueAsync<T>()

Gets the result data cast to T, once the dialog closes.

Task<T?> GetReturnValueAsync<T>()

Returns

Task<T>

Type Parameters

T

The expected type of the returned data.

InjectDialog(object)

Assigns the dialog content component instance.

void InjectDialog(object instance)

Parameters

instance object

The rendered dialog content component.

InjectOptions(TwDialogOptions)

Assigns the options used to display this dialog.

void InjectOptions(TwDialogOptions options)

Parameters

options TwDialogOptions

The options to use.

InjectRenderFragment(RenderFragment)

Replaces the rendered content of the dialog.

void InjectRenderFragment(RenderFragment renderFragment)

Parameters

renderFragment RenderFragment

The new content to render.

InjectTitle(string?)

Assigns the title displayed in the dialog header.

void InjectTitle(string? title)

Parameters

title string

The title to display.