xamarinxamarin.formsxamarin.androidimagesource

Uploading an image on a button click in XMAL


Why this does not load the image?

private void OnButtonClickedLoadImage(object sender, EventArgs e)
{
  ImageSource imgSrc = 
     ImageSource.FromFile("C:\\MyApp\\MyPicture.png");

  ImageViewerc.Source = imgSrc;
}

Solution

  • If you want to load local images, in Android, Place images in the Resources/drawable directory with Build Action: AndroidResource. In ios, The preferred way to manage and support images since iOS 9 is to use Asset Catalog Image Sets. Then use Asset Catalog Image Sets. The picture name can get the picture.