跳转至

IDialogService.ShowDialog<T> 方法

在模态对话框中显示 ViewModel,并在用户关闭对话框后返回。

命名空间: Eremex.AvaloniaUI.Controls.ApplicationServices
程序集: Eremex.Common.Contracts.dll
NuGet 包: Eremex.Common.Contracts

声明

public DialogResult ShowDialog<T>(T viewModel, string? caption = null)
    where T : IDialogAwareViewModel

类型参数

名称 说明
T 驱动对话框的 ViewModel 的类型。

参数

名称 类型 说明
viewModel T 要显示的 ViewModel。它提供对话框的内容和按钮,并在对话框打开期间一直附加到窗口。
caption string? 窗口标题。为 null 时,标题取自 Title。

返回值

类型 说明
DialogResult 关闭对话框时所用的按钮;如果用户通过窗口标题栏按钮关闭了对话框,则为 None。

另请参阅



* 本页面使用机器翻译技术翻译。

Used in articles