Table of Contents

Class BlazorVmDialogController

Namespace
Dmnk.Blazor.Dialogs
Assembly
Dmnk.Blazor.Dialogs.dll

A base class for an implementation of IVmDialogController. Allows registering ViewModels with the corresponding views using Register(Type, Type).

public abstract class BlazorVmDialogController : IVmDialogController
Inheritance
BlazorVmDialogController
Implements
Derived
Inherited Members
Extension Methods

Constructors

BlazorVmDialogController()

protected BlazorVmDialogController()

Methods

DefaultIconForIntent(MessageBoxType)

Return the default icon for a given message box type. This can be used by the MessageBoxViewModel and other similar dialogs to get the appropriate icon for the type of message box they are showing.

public abstract Icon DefaultIconForIntent(MessageBoxType type)

Parameters

type MessageBoxType

Returns

Icon

Register(Type, Type)

Like Register<TComponent, TViewModel>(), but allows registering open generic types.

public BlazorVmDialogController Register(Type componentType, Type viewModelType)

Parameters

componentType Type
viewModelType Type

Returns

BlazorVmDialogController

Examples

controller.Register(typeof(MyDialogView<>), typeof(MyDialogViewModel<>));

Register<TComponent, TViewModel>()

Register a viewmodel with its corresponding component. If your viewmodel is a generic class, use Register(Type, Type).

public BlazorVmDialogController Register<TComponent, TViewModel>() where TComponent : IVmDialogView where TViewModel : IVmDialogViewModel

Returns

BlazorVmDialogController

Type Parameters

TComponent
TViewModel

Examples

controller.Register>MyDialogView, MyDialogViewModel<();

Show<T>(VmDialogParameters, T)

Show the dialog for a given viewmodel.

Before calling this, the component should be registered with its corresponding viewmodel using e.g. Register<TComponent, TViewModel>().

public Task<VmDialogReference> Show<T>(VmDialogParameters parameters, T viewModel) where T : IVmDialogViewModel

Parameters

parameters VmDialogParameters
viewModel T

Returns

Task<VmDialogReference>

Type Parameters

T

Events

OnClose

Fired whenever a dialog is closed, either by calling Close() or Dismiss(). You typically won't need to use this, unless you are implementing a new dialog controller or provider.

public event Action<IVmDialogViewModel>? OnClose

Event Type

Action<IVmDialogViewModel>

OnShow

Fired whenever a dialog is shown using Show<T>(VmDialogParameters, T). You typically won't need to use this, unless you are implementing a new dialog controller or provider.

public event Action<(VmDialogParameters Parameters, Type Component, IVmDialogViewModel ViewModel, VmDialogReference Reference)>? OnShow

Event Type

Action<(VmDialogParameters Parameters, Type Component, IVmDialogViewModel ViewModel, VmDialogReference Reference)>