I am populating a ViewBox with an image, although I cannot seem to get it to center on the image. I've tried setting the ViewBox Fill to UniformToFill, centering the Image vertically and horizontally, etc and nothing seems to work.
XAML
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<Viewbox MaxWidth="500" MaxHeight="500" Name="vb1">
<Image x:Name="MyImage"/>
</Viewbox>
</StackPanel>
XAML.CS
BitmapImage bitimg = new BitmapImage(new Uri("/MyNewLink.jpg", UriKind.Relative));
MyImage.Source = bitimg as ImageSource;