title: How to Set ViewBox Image Source in Code Behind
body: <p>In following a code sample here <a href="http://msdn.microsoft.com/en-us/library/ms752301%28v=vs.110%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms752301(v=vs.110).aspx</a> I'd like to be able to change the following XAML code to C# and set the ViewBox source in code behind. What is the proper method of doing this? Must I set the Child of the ViewBox?</p>
  
  <pre><code>&lt;StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"&gt;
      &lt;Viewbox MaxWidth="500" MaxHeight="500" Name="vb1"&gt;
          &lt;Image Source="tulip_farm.jpg"/&gt;
      &lt;/Viewbox&gt;    
  &lt;/StackPanel&gt;
  </code></pre>