In my xaml file I am trying to set up a container that will house an unknown number of images, if I manually set an image inside there in the xaml file it works great:
<Image Source="Tamarin_portrait.JPG" WidthRequest="50" HeightRequest="50" Margin="10, 10, 10, 10"></Image>.
If I try to add a file from my cs side using an image online it works great:
var webImage = new Image { Source = ImageSource.FromUri(new Uri("https://xamarin.com/content/images/pages/forms/example-app.png")) }; imageContainer.Children.Add(webImage);
However if I try to add a local image to the imageContainer it fails to do so:
var locImage= new Image { Source = "Tamarin_portrait.JPG" }; //Or this way after declaring image without source-> locImage.Source = ImageSource.FromFile("Tamarin_portrait.JPG"); imageContainer.Children.Add(locImage);
I'm running it on android, and the image is located in the resources/drawable folder.
This feels like there's a simple mistake I'm making that I just don't see, can anyone shed some light on the problem?