title: How to change the background image of button on runtime?
body: <p>I m stuck with a problem. I want to change the background image of button on runtime. I got the solution for changing the color but i want to change the image.</p>
  
  <p>The code is as follows</p>
  
  <pre><code>public void buttonCase(object sender, RoutedEventArgs e)
  {
      Uri uri = null;
      var image = new ImageBrush();
      if (((App)App.Current).appControler.m_Mode == Controller.textMode.Letters)
      {
          ((App)App.Current).appControler.buttonCase(sender, e);
          switch (((App)App.Current).appControler.m_case)
          {
          case Controller.caseMode.Upper:
              b0.FontSize = b1.FontSize = b2.FontSize = b3.FontSize = b4.FontSize = b5.FontSize = b6.FontSize = b7.FontSize
              = b8.FontSize = b9.FontSize = bCornerLower.FontSize = 30.0;
              uri = new Uri(@"/SourceCode;component/Images/Lower_Case_p.png", UriKind.Relative);
              image.ImageSource = new BitmapImage(uri);
              btnCase.Background = image;
              break;
          case Controller.caseMode.Lower:
              b0.FontSize = b1.FontSize = b2.FontSize = b3.FontSize = b4.FontSize = b5.FontSize = b6.FontSize = b7.FontSize
              = b8.FontSize = b9.FontSize = bCornerLower.FontSize = 40.0;
              uri = new Uri(@"/SourceCode;component/Images/Case_p.png", UriKind.Relative);
              image.ImageSource = new BitmapImage(uri);
              btnCase.Background = image;
              break;
          }
      }
  }  
  </code></pre>