# DialogService.ShowDialog&lt;T&gt; method (1 of 2)

```csharp
public DialogResult ShowDialog<T>(T viewModel, string? caption)
    where T : IDialogAwareViewModel
```

## See Also

* class [DialogService](../DialogService.md)
* namespace [Eremex.AvaloniaUI.Controls.ApplicationServices](../index.md)

---

# DialogService.ShowDialog&lt;T&gt; method (2 of 2)

Shows a modal dialog on top of the specified window. When no owner is given, the active application window is used.

```csharp
public DialogResult ShowDialog<T>(T viewModel, string? caption, Window? owner)
    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 stays attached to the window until the dialog closes. |
| caption | The window caption. When `null`, the caption is taken from Title. |
| owner | The window the dialog is shown on top of. When `null`, the active application window is used. |

## Return Value

The button the dialog was closed with, or None if the user dismissed it through the window caption button.

## Exceptions

| exception | condition |
| --- | --- |
| ArgumentNullException | *viewModel* is `null`. |

## See Also

* class [DialogService](../DialogService.md)
* namespace [Eremex.AvaloniaUI.Controls.ApplicationServices](../index.md)

<!-- DO NOT EDIT: generated by xmldocmd for Eremex.Avalonia.Controls.ApplicationServices.dll -->
