title: wpf custom control send brush like TemplateBinding
body: <p>hi i created a custom control for button but there is problem in send Brush
  if you see down below i created before Radius and its work but the Brush is not.
  Note: It would be better if I put a picture to show the errors, rather than putting the code directly</p>
  <p><a href="https://i.stack.imgur.com/hcPTG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hcPTG.png" alt="enter image description here" /></a></p>
  <p>and here the source :</p>
  <p><a href="https://i.stack.imgur.com/1mXSu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1mXSu.png" alt="enter image description here" /></a></p>
  <p>here new code :</p>
  <pre><code>public class WPFButton : ButtonBase
      {
          public CornerRadius Radius
          {
              get { return (CornerRadius)GetValue(RadiusProperty); }
              set { SetValue(RadiusProperty, value); }
          }
  
          public static readonly DependencyProperty RadiusProperty =
              DependencyProperty.Register(&quot;Radius&quot;, typeof(CornerRadius), typeof(WPFButton), new PropertyMetadata(new CornerRadius(0)));
  
          public Brush MouseHoverColor
          {
              get { return (Brush)GetValue(MouseHoverColorProperty); }
              set { SetValue(MouseHoverColorProperty, value); }
          }
  
          public static readonly DependencyProperty MouseHoverColorProperty =
              DependencyProperty.Register(&quot;MouseHoverColor&quot;, typeof(Brush), typeof(WPFButton), new PropertyMetadata(new SolidColorBrush()) );
  
          static WPFButton()
          {
              DefaultStyleKeyProperty.OverrideMetadata(typeof(WPFButton), new FrameworkPropertyMetadata(typeof(WPFButton)));
          }
      }
  </code></pre>
  <p>Xaml</p>
  <pre><code>&lt;Style TargetType=&quot;{x:Type local:WPFButton}&quot;&gt;
          &lt;Setter Property=&quot;Template&quot;&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType=&quot;{x:Type local:WPFButton}&quot;&gt;
                      &lt;Border Name=&quot;Background&quot; Background=&quot;{TemplateBinding Background}&quot;
                              BorderBrush=&quot;{TemplateBinding BorderBrush}&quot;
                              BorderThickness=&quot;{TemplateBinding BorderThickness}&quot; CornerRadius=&quot;{TemplateBinding Radius}&quot;&gt;
                          &lt;ContentPresenter Content=&quot;{TemplateBinding Content}&quot; HorizontalAlignment=&quot;Center&quot; VerticalAlignment=&quot;Center&quot;&gt;&lt;/ContentPresenter&gt;
                      &lt;/Border&gt;
  
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;Trigger Property=&quot;IsMouseOver&quot; Value=&quot;True&quot;&gt;
                              &lt;Setter Property=&quot;Background&quot; TargetName=&quot;Background&quot; Value=&quot;{TemplateBinding MouseHoverColor}&quot;&gt;
  
                              &lt;/Setter&gt;
                          &lt;/Trigger&gt;
                         
                          &lt;Trigger Property=&quot;IsPressed&quot; Value=&quot;True&quot;&gt;
                              &lt;Setter Property=&quot;Background&quot; TargetName=&quot;Background&quot; Value=&quot;#FF4792DC&quot;&gt;
  
                              &lt;/Setter&gt;
                          &lt;/Trigger&gt;
                      &lt;/ControlTemplate.Triggers&gt;
  
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>