Method CreateDialogViewModel
CreateDialogViewModel<TViewModel>(params object?[])
Creates a dialog view model with constructor injection, the same way the navigator creates routed view models. Explicit arguments are matched to
constructor parameters by type (positionally among parameters of the same type); remaining parameters are resolved from child services registered
by the dialogs this presenter is nested in and by the active route's view models (nearest first), then from RootServices, then from
parameter default values. The view model's Navigator is available inside its constructor.
Declaration
TViewModel CreateDialogViewModel<TViewModel>(params object?[] explicitArgs) where TViewModel : class, IDialogViewModel
Parameters
| Type | Name | Description |
|---|---|---|
| object[] | explicitArgs | Values for constructor parameters that are not services (e.g. the item being edited). Must not contain nulls. |
Returns
| Type | Description |
|---|---|
| TViewModel |
Type Parameters
| Name | Description |
|---|---|
| TViewModel | The dialog view model type, which must have a single public constructor. |
Remarks
A dialog view model created by a presenter can only be shown by that presenter, since the services it received were resolved in that presenter's scope. If any service came from a view model that is no longer active when the dialog is shown, showing it throws. Create dialog view models immediately before showing them.