也許有人可以告訴我如何在Metro窗口中正確實現異步消息,它將具有應用程序的當前主題和口音?Metro MahApps MessageBox主題
從演示樣本作品所採取的代碼,但主題和重點依然默認:
private async void ClosingApp(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = !_shutdown;
if (_shutdown) return;
var mySettings = new MetroDialogSettings()
{
AffirmativeButtonText = "Quit",
NegativeButtonText = "Cancel",
AnimateShow = true,
AnimateHide = false
};
var result = await this.ShowMessageAsync("Quit application?",
"Sure you want to quit application?",
MessageDialogStyle.AffirmativeAndNegative, mySettings);
_shutdown = result == MessageDialogResult.Affirmative;
if (_shutdown)
Application.Current.Shutdown();
}
當我簡單地改變主題:
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
// set the Red accent and dark theme only to the current window
var theme = ThemeManager.GetAppTheme("BaseDark");
var accent = ThemeManager.GetAccent("Red");
ThemeManager.ChangeAppStyle(Application.Current, accent, theme);
}
我得到默認的白色和藍色的MessageBox。我究竟做錯了什麼?
好像沒有默認值(樣式/口音/ Blue.xaml,樣式/口音/ BaseLight.xaml)來源 在App.xaml中,帶主題的MessageBox不起作用。我只需要添加這些。謝謝。 – Beldrak
是的,您必須在App.xaml中添加上面顯示的資源。我很高興能夠提供幫助 – 2016-04-27 09:21:16