Load image dynamically into a grid?

Asked

Viewed 117 times

-1

I have this shampoo:

<StackLayout Spacing="10" Padding="10" VerticalOptions="Center" Grid.Row="3" Grid.Column="1" >
    <Image x:Name="MyImage" Source="{local:ImageResource Operacional.Images.images1.png}" >
       <Image.GestureRecognizers>
           <TapGestureRecognizer Tapped="OnTrocaImageTapGestureReconizerTapped" NumberOfTapsRequired="1"></TapGestureRecognizer>
       </Image.GestureRecognizers>
   </Image>
</StackLayout>

by clicking on the image(Slap) I change the image. I did this in Behind and it turns out that when I click, the first image disappears, but the second one does not appear.

void OnTrocaImageTapGestureReconizerTapped(object sender, EventArgs e)
{
     MyImage.Source = "Operacional.Images.fechar1.png";
}

1 answer

-1

I resolved so:

void OnTrocaImageTapGestureReconizerTapped(object sender, EventArgs e) { MyImage.Source = ImageSource.FromResource("Operacional.Images.fechar1.png"); }

Browser other questions tagged

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