[英]Overwrite button's style in a Mahapps Metro dialog
我想用自定义对话框重写Mahapps Metro对话框中按钮的颜色(而不是使用强调颜色)。 我最想更改单击时显示的按钮的颜色。 这是单击按钮时的默认样式。
App.xaml中:
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Crimson.xaml"/>
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml"/>
<ResourceDictionary Source="Styles.xaml" />
MainWindow.xaml:
<Grid>
<Button
Content="Open Metro Dialog"
Click="Button_Click"
Style="{StaticResource ButtonStyle}"
/>
</Grid>
MainWindow.xaml.cs
public partial class MainWindow : WindowBase
{
public MainWindow()
{
InitializeComponent();
}
private async void Button_Click(object sender, RoutedEventArgs e)
{
MessageDialogResult dialogResult = await this.ShowMessageAsync("Close window", "Are you sure you want to close the window?", MessageDialogStyle.Affirmative);
if (dialogResult == MessageDialogResult.Affirmative)
{
this.Close();
}
}
}
到目前为止我尝试过的是:
有什么办法可以做到这一点?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.