title: Changing the Image Source of a nested Image of a Button On Click in WPF
body: <p>I have a series of buttons that act as toggle-able items (with more than 2 states).  I have a single method managing the click even on all of them, but I also need to update the image contained inside each button to match it's state every time they get clicked.  My XAML looks like this:</p>
  
  <pre><code>&lt;Button Name="Button1" Style="{StaticResource ImageButton}" Click="OnClick_MyButtonClick"&gt;
      &lt;Image Name="Button1_Image_Default" Source="Images\Button1_Default"/&gt;
  &lt;/Button&gt;
  
  &lt;Button Name="Button2" Style="{StaticResource ImageButton}" Click="OnClick_MyButtonClick"&gt;
      &lt;Image Name="Button2_Image_Default" Source="Images\Button2_Default"/&gt;
  &lt;/Button&gt;
  
  &lt;Button Name="Button3" Style="{StaticResource ImageButton}" Click="OnClick_MyButtonClick"&gt;
      &lt;Image Name="Button3_Image_Default" Source="Images\Button3_Default" /&gt;
  &lt;/Button&gt;
  </code></pre>
  
  <p>I then have some C# in the back that looks like so:</p>
  
  <pre><code>void OnClick_MyButtonClick(object sender, RoutedEventArgs e)
  {
      string buttonClicked = (sender as Button).Name;
  
      // filterDictionary is a Dictionary which contains the names and references of every button.
      int thisFilterCurrentValue = filterDictionary[buttonClicked];
  
      if (thisFilterCurrentValue == 0)
      {
          thisFilterCurrentValue++;
          //Psuedo Code:
          buttonClicked.Image.Source = "Images/buttonClickedOnce.gif";
      }
  
      if (thisFilterCurrentValue == 1)
      {
          thisFilterCurrentValue++;
          //Psuedo Code:
          buttonClicked.Image.Source = "Images/buttonClickedTwice.gif";
      }
  
      if (thisFilterCurrentValue == 2)
      {
          thisFilterCurrentValue = 0;
          //Psuedo Code:
          buttonClicked.Image.Source = "Images/buttonClickedThrice.gif";
      }
  }
  </code></pre>
  
  <p>The issue is that I have no idea how to reference the 'Source' property of the  element that each  Contains.</p>
  
  <p>How would I go about this?</p>