我使用 MVVM 模式创建了最简单的 WPF 项目。如何从我的 viewModel 调用 ShowMessageAsync
?
if (DisciplineText!="")
{
Disciplines.Add(new Discipline(){ChairID = SelectedChair.ChairID,SemesterID = SelectedSemester.SemesterID,Discipline1 = DisciplineText});
Context.SaveChanges();
}
else
{
// ShowMessageAsync????????
}
最佳答案
MetroWindow metroWindow = Application.Current.MainWindow as MetroWindow;
metroWindow.MetroDialogOptions.ColorScheme = MetroDialogColorScheme.Accented; // set the theme
await MetroWindow.ShowMessageAsync("Title", "Message");
你需要使用:
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
希望对你有所帮助:)
关于c# - Mahapp ShowMessageAsync MvvM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26825250/