创建image
<Image x:Name="img" HorizontalAlignment="Left" Height="165" Margin="513,15,0,0" VerticalAlignment="Top" Width="105" />
设置图片
//设置图片
public void AddImage()
{
BitmapImage bi = new BitmapImage();
// BitmapImage.UriSource must be in a BeginInit/EndInit block.
bi.BeginInit();
bi.UriSource = new Uri(@"C:\Users\Administrator\Desktop\1.jpg", UriKind.RelativeOrAbsolute);
bi.EndInit();
img.Source = bi;
}