I want to rewrite the color of the buttons in an Mahapps Metro dialog with a custom one (not by using Accent color). I am mostly interested in changing the color of the button that is displayed while being clicked. This is the default style of the button when is being clicked.
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();
}
}
}
What i tried so far:
- Rewrite the Mahapps Metro color with key 'BlackBrush' (this one is being used as background color for the button) with a custom one;
- Rewrite the control template for the button.
Is there any way to achieve this?