Transfer image from one Image control to another of the same type

Asked

Viewed 49 times

0

I have these three controls:

<Button x:Name="btn" />
<Image x:Name="imagem01" />
<Image x:Name="imagem02" />

Suppose I carry an image on "imagem01" using:

OpenFileDialog ofdImage = new OpenFileDialog();
ofdImage.Filter = "JPEG Files|*.jpg|Bitmap Files|*.bmp|Gif Files|*.gif";
ofdImage.DefaultExt = "jpg";
ofdImage.FilterIndex = 1;
if (ofdImage.ShowDialog() == true)
{
    this.imagem02.Source = new BitmapImage(new Uri(ofdImage.FileName));
}

What code should I write, associated with the button "btn", in order to load in image02 the same image I have in "imagem01".

1 answer

0

Arghh ... I can’t believe it was that simple:

imagem02.Source = imagem01.Source;

Browser other questions tagged

You are not signed in. Login or sign up in order to post.