title: how to change style component programmatically
body: <p>I make a image into button control. Now i want to change that image using c# code.</p>
  
  <pre class="lang-xml prettyprint-override"><code> &lt;Style x:Key="ButtonStyle1" TargetType="{x:Type Button}"&gt;
          &lt;Setter Property="Template"&gt;
              &lt;Setter.Value&gt;
                  &lt;ControlTemplate TargetType="{x:Type Button}"&gt;
                      &lt;Grid&gt;
                          &lt;Image x:Name="MyImage" Source="r.png" Stretch="Fill"/&gt;
                          &lt;ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/&gt;
                      &lt;/Grid&gt;
                      &lt;ControlTemplate.Triggers&gt;
                          &lt;Trigger Property="IsFocused" Value="True"/&gt;
                          &lt;Trigger Property="IsDefaulted" Value="True"/&gt;
                          &lt;Trigger Property="IsMouseOver" Value="True"/&gt;
                          &lt;Trigger Property="IsPressed" Value="True"/&gt;
                          &lt;Trigger Property="IsEnabled" Value="False"/&gt;
                      &lt;/ControlTemplate.Triggers&gt;
                  &lt;/ControlTemplate&gt;
              &lt;/Setter.Value&gt;
          &lt;/Setter&gt;
      &lt;/Style&gt;
  </code></pre>
  
  <p>I want to Change MyImage Using C# Code.
  thank`s for help</p>