Table of Contents

Interface ITwDialogService

Namespace
TwBlazor.Services
Assembly
TwBlazor.dll

Shows and closes dialogs rendered through TwDialog from C# code.

public interface ITwDialogService

Remarks

This service requires a TwDialogProvider in the active render tree, typically placed once in your layout.

Methods

Close(ITwDialogReference)

Closes the specified dialog with a successful, empty result.

void Close(ITwDialogReference dialog)

Parameters

dialog ITwDialogReference

The reference of the dialog to close.

Close(ITwDialogReference, TwDialogResult?)

Closes the specified dialog with the given result.

void Close(ITwDialogReference dialog, TwDialogResult? result)

Parameters

dialog ITwDialogReference

The reference of the dialog to close.

result TwDialogResult

The result to include.

CreateReference()

Creates a dialog reference without showing it.

ITwDialogReference CreateReference()

Returns

ITwDialogReference

The created dialog reference.

ShowAsync(Type)

Displays a dialog for the specified component type.

Task<ITwDialogReference> ShowAsync(Type component)

Parameters

component Type

The dialog content to display.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?)

Displays a dialog for the specified component type with a custom title.

Task<ITwDialogReference> ShowAsync(Type component, string? title)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?, TwDialogOptions)

Displays a dialog for the specified component type with a custom title and options.

Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogOptions options)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?, TwDialogParameters)

Displays a dialog for the specified component type with a custom title and parameters.

Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogParameters parameters)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync(Type, string?, TwDialogParameters, TwDialogOptions)

Displays a dialog for the specified component type with a custom title, parameters, and options.

Task<ITwDialogReference> ShowAsync(Type component, string? title, TwDialogParameters parameters, TwDialogOptions options)

Parameters

component Type

The dialog content to display.

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

ShowAsync<TComponent>()

Displays a dialog.

Task<ITwDialogReference> ShowAsync<TComponent>() where TComponent : IComponent

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?)

Displays a dialog with a custom title.

Task<ITwDialogReference> ShowAsync<TComponent>(string? title) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?, TwDialogOptions)

Displays a dialog with a custom title and options.

Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogOptions options) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?, TwDialogParameters)

Displays a dialog with a custom title and parameters.

Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogParameters parameters) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(string?, TwDialogParameters, TwDialogOptions?)

Displays a dialog with a custom title, parameters, and options.

Task<ITwDialogReference> ShowAsync<TComponent>(string? title, TwDialogParameters parameters, TwDialogOptions? options) where TComponent : IComponent

Parameters

title string

The text at the top of the dialog.

parameters TwDialogParameters

The custom parameters to set on the dialog content.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(TwDialogOptions)

Displays a dialog with options.

Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogOptions options) where TComponent : IComponent

Parameters

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(TwDialogParameters)

Displays a dialog with parameters.

Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogParameters parameters) where TComponent : IComponent

Parameters

parameters TwDialogParameters

The custom parameters to set on the dialog content.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

ShowAsync<TComponent>(TwDialogParameters, TwDialogOptions)

Displays a dialog with parameters and options.

Task<ITwDialogReference> ShowAsync<TComponent>(TwDialogParameters parameters, TwDialogOptions options) where TComponent : IComponent

Parameters

parameters TwDialogParameters

The custom parameters to set on the dialog content.

options TwDialogOptions

The custom display options for the dialog.

Returns

Task<ITwDialogReference>

A reference to the dialog.

Type Parameters

TComponent

The dialog content to display.

Events

DialogInstanceAddedAsync

Occurs when a new dialog instance is created and needs to be rendered.

event Func<ITwDialogReference, Task>? DialogInstanceAddedAsync

Event Type

Func<ITwDialogReference, Task>

OnDialogCloseRequested

Occurs when a request is made to close a dialog.

event Action<ITwDialogReference, TwDialogResult?>? OnDialogCloseRequested

Event Type

Action<ITwDialogReference, TwDialogResult>