# IDialogService.ShowDialog&lt;T&gt; method

Shows the view model in a modal dialog and returns once the user closes it.

```csharp
public DialogResult ShowDialog<T>(T viewModel, string? caption = null)
    where T : IDialogAwareViewModel
```

| parameter | description |
| --- | --- |
| T | The type of the view model that drives the dialog. |
| viewModel | The view model to display. It supplies the dialog content and buttons, and is attached to the window for as long as the dialog is open. |
| caption | The window caption. When `null`, the caption is taken from [`Title`](../IWindowAwareViewModel/Title.md). |

## Return Value

The button the dialog was closed with, or None if the user dismissed it through the window caption button.

## See Also

* enum [DialogResult](../DialogResult.md)
* interface [IDialogAwareViewModel](../IDialogAwareViewModel.md)
* interface [IDialogService](../IDialogService.md)
* namespace [Eremex.AvaloniaUI.Controls.ApplicationServices](../index.md)

<!-- DO NOT EDIT: generated by xmldocmd for Eremex.Common.Contracts.dll -->
