I want to change the style of the Min, Max, and Close buttons for my WPF application.
I use Mahapps.Metro , and I managed to achieve the result that I want, but only with outdated WindowMinButtonStyle WindowMaxButtonStyleand WindowCloseButtonStylein class MetroWindow. An outdated message, such as a property WindowMinButtonStyle, reads:
This property will be removed in a future version. You must use LightMinButtonStyle or DarkMinButtonStyle in WindowButtonCommands to override the style.
The problem is that I cannot figure out how to do this specifically. The class MetroWindowhas a field called WindowButtonCommands, but it is internal, therefore, it seems that it is the wrong tree to bark up. I am new to WPF and there is no information on how to do this in the manuals on their website, so I'm pretty lost. I hope someone can provide me with a short code example to point me in the right direction.
EDIT . Here XAML issues a warning:
<controls:MetroWindow x:Class="Project.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
WindowMinButtonStyle="{DynamicResource DarkWindowButtonStyle}"
WindowMaxButtonStyle="{DynamicResource DarkWindowButtonStyle}"
WindowCloseButtonStyle="{DynamicResource DarkWindowCloseButtonStyle}">
<Grid>
</Grid>
</controls:MetroWindow>
I should also mention that I am using the new v1.2.0 from Mahapps.Metro, but I had the same problem with the previous version. Source code of Mahapps.Metro, which has attributes Obsolete: https://github.com/MahApps/MahApps.Metro/blob/develop/MahApps.Metro/Controls/MetroWindow.cs#L88-L93