如何更改MahApps.Metro对话框样式?

时间:2016-02-06 09:18:14

标签: wpf xaml modal-dialog controltemplate mahapps.metro

我想更改消息对话框的样式。我用过这个:How to change MahApps.Metro dialog content template width?

我想要一些对话的不同风格。如何更改单个对话框的样式?我尝试用CustomResourceDictionary属性来做。但这没有效果。

var Style = (Style) Application.Current.Resources["NewCustomDialogStyle"];
var mySettings = new MetroDialogSettings()
    {
        CustomResourceDictionary = Style.Resources
    };

当我覆盖MessageDialog样式时,一切都很好

<Style TargetType="{x:Type Dialog:MessageDialog}" BasedOn="{StaticResource NewCustomDialogStyle}" />

1 个答案:

答案 0 :(得分:0)

You need create new style based on Mahapps style. You can find it here: https://github.com/MahApps/MahApps.Metro/blob/336f7dfc4bda2d0eba8aa270737ca3c11d45128c/src/MahApps.Metro/MahApps.Metro/Themes/Dialogs/MessageDialog.xaml

And then use it only for whatever you want dialog