title: How to set CornerRadius of a wpf button border via style and databinding
body: <p>I have a simple WPF Button as under:-</p>
  
  <pre><code> &lt;Button Height="150" Width="145" Canvas.Top="8" Canvas.Left="9" x:Name="cmdButton_Template" Background="{Binding Button_BackGround}" Style="{StaticResource MyLocalButton}" Mouse.PreviewMouseUp="cmdButton_Template_PreviewMouseUp"  &gt;
      &lt;Label&gt;
          &lt;ContentControl HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch" Height="131" Canvas.Left="10" Canvas.Top="10"    Width="142" &gt;
          &lt;Canvas x:Name="ContentCanvas"&gt;
              &lt;TextBlock  Canvas.Left="{Binding Text_2_Left,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Canvas.Top="{Binding Text_2_Top,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  Text="{Binding Text, ElementName=txtItem_Cat_Name2,UpdateSourceTrigger=PropertyChanged}"   FontSize="{Binding Font_Size_2}"  FontFamily="{Binding Font_Name_2}" Foreground="{Binding Font_Color_2}"  FontStyle="{Binding ElementName=chkItalic_2,Path=IsChecked,Converter={StaticResource FIC}, UpdateSourceTrigger=PropertyChanged}" TextDecorations="{Binding Font_Underline_2,Converter={StaticResource FUC}}" FontWeight="{Binding Font_Bold_2,Converter={StaticResource FVT}}"  x:Name="Button_Text_2"  MouseLeftButtonUp="Button_Text_2_MouseLeftButtonUp"  Grid.RowSpan="3"/&gt;
          &lt;/Canvas&gt;
          &lt;/ContentControl&gt;
      &lt;/Label&gt;
   &lt;/Button&gt;
  </code></pre>
  
  <p>and i have a style like this in userControl.Resources like this:</p>
  
  <pre><code>&lt;UserControl.Resources&gt;
  &lt;Style x:Key="MyLocalButton" TargetType="Button"&gt;
           &lt;Setter Property="OverridesDefaultStyle" Value="True" /&gt;
           &lt;Setter Property="Cursor" Value="Hand" /&gt;
           &lt;Setter Property="Template"&gt;
               &lt;Setter.Value&gt;
                   &lt;ControlTemplate TargetType="Button"&gt;
                       &lt;Border Name="borderZero" BorderThickness="0" BorderBrush="Black" Background="{TemplateBinding Background}" CornerRadius="{Binding AllCorners,Mode=OneWay,UpdateSourceTrigger=PropertyChanged}"&gt;
                           &lt;ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" /&gt;
                       &lt;/Border&gt;
                       &lt;ControlTemplate.Triggers&gt;
                           &lt;Trigger Property="IsMouseOver" Value="True"&gt;
                               &lt;Setter Property="Opacity" Value="0.8" /&gt;
                           &lt;/Trigger&gt;
  
                       &lt;/ControlTemplate.Triggers&gt;
                   &lt;/ControlTemplate&gt;
               &lt;/Setter.Value&gt;
           &lt;/Setter&gt;
      &lt;/Style&gt;
  
  &lt;Style x:Key="SomeButtonStyle" TargetType="Button"&gt;
            &lt;Setter Property="Background" Value="Black" /&gt;
            &lt;Setter Property="Template"&gt;
                &lt;Setter.Value&gt;
                    &lt;ControlTemplate TargetType="Button"&gt;
                        &lt;Grid Background="{TemplateBinding Background}"&gt;
                            &lt;ContentPresenter /&gt;
                        &lt;/Grid&gt;
                    &lt;/ControlTemplate&gt;
                &lt;/Setter.Value&gt;
            &lt;/Setter&gt;
      &lt;/Style&gt;
    &lt;/UserControl.Resources&gt;
  </code></pre>
  
  <p>This is my DataModel:</p>
  
  <pre><code> public class DM_ButtonSettings
    {
       public CornerRadius _AllCorners = new CornerRadius(10, 10, 10, 10);
         public CornerRadius AllCorners
         {
             get { return _AllCorners; }
             set
             {
                 if (_AllCorners != value)
                 {
                     _AllCorners = value;
  
                 }
             }
          }
    }
  </code></pre>
  
  <p>and this is my ViewModel:</p>
  
  <pre><code>public class DC_ButtonSettings:INotifyPropertyChanged
   {
   public CornerRadius _AllCorners = new CornerRadius(10, 10, 10, 10);
          public CornerRadius AllCorners
          {
              get { return _AllCorners; }
              set
              {
                  if (_AllCorners != value)
                  {
                      _AllCorners = value;
                      RaisePropertyChangedEvent("AllCorners");
                  }
              }
       }
   }
  </code></pre>
  
  <p>I have a ViewModel property named CornerRadius and i am trying to change the Radius of the button corners at runtime using that property by binding it to style in the local resoources of the user control.
  I am passing an object of this ViewModel to the form where the Button lies,and am trying to change the Button corner radius by changing the CornerRadius programatically as per the program logic.Though the values in the ViewModel are getting changed,but the View is not getting updated.I know i am missing something very simple here,but am unable to figure out on my own.
  How do i do it right?</p>