title: WPF - Customize the style of MessageBox in Extended WPF Toolkit
body: <p>For the sake of customization for MessageBox's style , I use this toolkit, and I copy the style code from its official page:</p>
  
  <p><a href="http://wpftoolkit.codeplex.com/wikipage?title=MessageBox&amp;referringTitle=Documentation" rel="nofollow noreferrer">http://wpftoolkit.codeplex.com/wikipage?title=MessageBox&amp;referringTitle=Documentation</a></p>
  
  <p>I changed it a bit: </p>
  
  <pre><code>&lt;Application x:Class="TotaraEditor.App"
               xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
               xmlns:local="clr-namespace:TotaraEditor"
               xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
               StartupUri="MainWindow.xaml"
               ShutdownMode="OnMainWindowClose"&gt;
      &lt;Application.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;ResourceDictionary.MergedDictionaries&gt;
                  &lt;ResourceDictionary Source="Themes/MetroDark/MetroDark.MSControls.Core.Implicit.xaml" /&gt;
                  &lt;ResourceDictionary Source="Themes/MetroDark/MetroDark.MSControls.Toolkit.Implicit.xaml" /&gt;
              &lt;/ResourceDictionary.MergedDictionaries&gt;
  
              &lt;SolidColorBrush x:Key="MyButtonHoverBrush" Color="#FF2D2D30" /&gt;
              &lt;SolidColorBrush x:Key="MyButtonPressedBrush" Color="#FF03A9DD" /&gt;
  
              &lt;Style x:Key="MyCloseButtonStyle" TargetType="Button"&gt;
                  &lt;Setter Property="Template"&gt;
                      &lt;Setter.Value&gt;
                          &lt;ControlTemplate TargetType="Button"&gt;
                              &lt;Grid&gt;
                                  &lt;VisualStateManager.VisualStateGroups&gt;
                                      &lt;VisualStateGroup x:Name="CommonStates"&gt;
                                          &lt;VisualState x:Name="Normal"/&gt;
                                          &lt;VisualState x:Name="MouseOver"&gt;
                                              &lt;Storyboard&gt;
                                                  &lt;ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background)"&gt;
                                                      &lt;DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource MyButtonHoverBrush}"&gt;&lt;/DiscreteObjectKeyFrame&gt;
                                                  &lt;/ObjectAnimationUsingKeyFrames&gt;
                                              &lt;/Storyboard&gt;
                                          &lt;/VisualState&gt;
                                          &lt;VisualState x:Name="Pressed"&gt;
                                              &lt;Storyboard&gt;
                                                  &lt;ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background)"&gt;
                                                      &lt;DiscreteObjectKeyFrame KeyTime="00:00:00" Value="{StaticResource MyButtonPressedBrush}"&gt;&lt;/DiscreteObjectKeyFrame&gt;
                                                  &lt;/ObjectAnimationUsingKeyFrames&gt;
                                              &lt;/Storyboard&gt;
                                          &lt;/VisualState&gt;
                                      &lt;/VisualStateGroup&gt;
                                  &lt;/VisualStateManager.VisualStateGroups&gt;
                                  &lt;Border x:Name="Background" CornerRadius="0,0,0,0" Background="Green"&gt;
                                      &lt;Border Margin="1,0,1,1" BorderBrush="#59FFFFFF" BorderThickness="1" CornerRadius="0,0,1,0"/&gt;
                                  &lt;/Border&gt;
                                  &lt;ContentPresenter x:Name="contentPresenter" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/&gt;
                                  &lt;Path x:Name="path" Fill="White" Margin="0,0,0,1" Visibility="Collapsed"
                      Height="60"
          Width="7"
          Stretch="Fill"
          Opacity="1"
          Data="M 2,6 C2,6 3,6 3,6 3,6 3,5 3,5 3,5 4,5 4,5 4,5 4,6 4,6 4,6 5,6 5,6 5,6 7,6 7,6 7,6 7,5 7,5 7,5 6,5 6,5 6,5 6,4 6,4 6,4 5,4 5,4 5,4 5,2 5,2 5,2 6,2 6,2 6,2 6,1 6,1 6,1 7,1 7,1 7,1 7,0 7,0 7,0 5,0 5,0 5,0 4,0 4,0 4,0 4,1 4,1 4,1 3,1 3,1 3,1 3,0 3,0 3,0 2,0 2,0 2,0 0,0 0,0 0,0 0,1 0,1 0,1 1,1 1,1 1,1 1,2 1,2 1,2 2,2 2,2 2,2 2,4 2,4 2,4 1,4 1,4 1,4 1,5 1,5 1,5 0,5 0,5 0,5 0,6 0,6 0,6 2,6 2,6 z"/&gt;
                              &lt;/Grid&gt;
                          &lt;/ControlTemplate&gt;
                      &lt;/Setter.Value&gt;
                  &lt;/Setter&gt;
              &lt;/Style&gt;
  
              &lt;Style TargetType="{x:Type toolkit:MessageBox}"&gt;
                  &lt;Setter Property="Background" Value="#FF1E1E1E" /&gt;
                  &lt;Setter Property="BorderBrush" Value="#FF999999" /&gt;
                  &lt;Setter Property="CaptionForeground" Value="#FFF1F1F1" /&gt;
                  &lt;Setter Property="WindowBorderBrush" Value="#FF686868" /&gt;
                  &lt;Setter Property="WindowBackground" Value="#FF2D2D30" /&gt;
                  &lt;Setter Property="WindowOpacity" Value="0.3" /&gt;
                  &lt;Setter Property="Foreground" Value="#FFF1F1F1"/&gt;
                  &lt;Setter Property="CloseButtonStyle" Value="{StaticResource MyCloseButtonStyle}"/&gt;
              &lt;/Style&gt;
  
  
  
          &lt;/ResourceDictionary&gt;
  
      &lt;/Application.Resources&gt;
  &lt;/Application&gt;
  </code></pre>
  
  <p>This is how I use it in code behind:</p>
  
  <pre><code>var res = Xceed.Wpf.Toolkit.MessageBox.Show( 
                              "R U sure?", 
                              "Confirm dialog", 
                              MessageBoxButton.YesNoCancel, 
                              MessageBoxImage.None, 
                              MessageBoxResult.Cancel, 
                              null 
                          ); 
  if ("Cancel" == res.ToString()) {...} 
  else if ("No" == res.ToString()) {...} 
  else if ("Yes" == res.ToString()) {...} 
  else {...}
  </code></pre>
  
  <p>And now what I have got is:
  <a href="https://i.stack.imgur.com/b42Da.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/b42Da.png" alt="enter image description here"></a></p>
  
  <p>As there is no way to touch the XAML of those buttons, how should I change the buttons style? At least I want to remove the glowing effect of the header.</p>
  
  <p>Thanks.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I am sure the glowing effect is not caused by some style applied to the Label, it is a styled rectangle underneath the Label, I found this in WPF Inspector:</p>
  
  <p><a href="https://i.stack.imgur.com/FxTnb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FxTnb.png" alt="enter image description here"></a></p>
  
  <p>After I set the height of that rect to 0, that glowing thing disappeared.</p>