Conner Christ
Conner Christ

Reputation: 63

How do I add an Image in Xamarin while using Jetbrain Rider?

I'm currently using Jetbrain's Rider as an IDE and there aren't any tutorials online about managing image resources with Xamarin and Rider together. Right now I can't get an image to display at all. My Project tree goes

In my .cs file I have this code. _s is a StackLayout and I know that adding to it's children works.

var image = new Image { Source = ImageSource.FromResource("Testing.Resources.drawable.ball.png", typeof(MainPage).GetTypeInfo().Assembly) };
_s.Children.Add(image);

I have ball.png's build action set as Embedded Resource. This is all I could find online in documentation stuff. Any help would be greatly appreciated.

Upvotes: 1

Views: 690

Answers (1)

Conner Christ
Conner Christ

Reputation: 63

I tested it out in Visual Studio per @Steven's request, and it worked. I didn't change any code, switched back to Rider, and it magically worked. I guess that's what I get for not using Visual Studio.

Upvotes: 0

Related Questions