Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mahapp ShowMessageAsync MvvM

I created the simplest WPF project with a MVVM pattern. How can I call ShowMessageAsync from my viewModel?

 if (DisciplineText!="")
 {
     Disciplines.Add(new Discipline(){ChairID = SelectedChair.ChairID,SemesterID = SelectedSemester.SemesterID,Discipline1 = DisciplineText});
     Context.SaveChanges();
 }
 else
 {
     //  ShowMessageAsync????????
 }
like image 662
user3351644 Avatar asked Sep 14 '26 15:09

user3351644


1 Answers

MetroWindow metroWindow = Application.Current.MainWindow as MetroWindow;
metroWindow.MetroDialogOptions.ColorScheme = MetroDialogColorScheme.Accented; // set the theme
await MetroWindow.ShowMessageAsync("Title", "Message");

You need to use :

using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;

I hope it help :)

like image 189
C1rdec Avatar answered Sep 17 '26 05:09

C1rdec



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!