Mahapps.metro: how do i change the window close button's color to red ?

Created on 29 Nov 2014  路  1Comment  路  Source: MahApps/MahApps.Metro

I find the property named "windowclosebuttonstyle" , but i don't know how to change it , i just want to change the close button's color to red . I need the help .

Most helpful comment

@trlanfeng

    <Style x:Key="CleanCloseWindowButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource MetroWindowButtonStyle}">
        <Style.Triggers>

            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#EB2F2F" />
                <Setter Property="Foreground" Value="{DynamicResource WhiteBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="#7C0000" />
            </Trigger>

        </Style.Triggers>
    </Style>

usage

<Controls:MetroWindow x:Class="MetroDemo.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      Title="MahApps.Metro - Demo Application"

                      WindowCloseButtonStyle="{DynamicResource CleanCloseWindowButtonStyle}"

                      >

</Controls:MetroWindow>

>All comments

@trlanfeng

    <Style x:Key="CleanCloseWindowButtonStyle" TargetType="{x:Type Button}" BasedOn="{StaticResource MetroWindowButtonStyle}">
        <Style.Triggers>

            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="#EB2F2F" />
                <Setter Property="Foreground" Value="{DynamicResource WhiteBrush}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="#7C0000" />
            </Trigger>

        </Style.Triggers>
    </Style>

usage

<Controls:MetroWindow x:Class="MetroDemo.MainWindow"
                      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:Controls="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
                      Title="MahApps.Metro - Demo Application"

                      WindowCloseButtonStyle="{DynamicResource CleanCloseWindowButtonStyle}"

                      >

</Controls:MetroWindow>
Was this page helpful?
0 / 5 - 0 ratings

Related issues

kayone picture kayone  路  10Comments

punker76 picture punker76  路  30Comments

AndrzejKl picture AndrzejKl  路  12Comments

oschwab picture oschwab  路  17Comments

webprofusion-chrisc picture webprofusion-chrisc  路  11Comments