Xamarin iOS ImageView Issue

If you’re working in Xamarin on iOS and running into trouble selecting from your graphic Assets when trying to set the image on an ImageView control in the Storyboard designer, read on.

It turns out that in the latest version of Xamarin there’s a weird bug that’s shown up in the Storyboard design surface running in Visual Studio on Windows (this is not an issue if you’re working on a Mac). You don’t need to do much to see this problem – just start a simple Xamarin Forms application, add a graphic to the Assets under iOS, open the splash screen Storyboard, and try to set the Image property of the default ImageView to that asset. What you’ll see instead is that when you click the drop-down list for the Image property, instead of a list to select your asset from, you’ll get a Windows Explorer dialog asking you to browse to and select a graphic file (if you do this, it will add the file to your Resources folder but it still won’t be displayed in your ImageView).

A simple work-around

Many have wasted hours trying to resolve this but it turns out there’s a simple work-around; quirky, but simple.

  1. Build and run your app [this is just to confirm everything is working and to make sure your .Net Standard project is built
  2. Right-click on your .Net Standard project and select “Unload Project”
  3. Double-click on your Storyboard file to open the designer
  4. You’ll find that the Asset (image) selectors are working correctly; make your changes to the storyboard
  5. Because of step 1, you can still do “F5” test build/run cycles to make sure your storyboard is behaving
  6. When you’re done with your storyboard edits, close it
  7. Right-click on the .Net Standard project and select “Reload Project”

I’ve broken it out in extreme detail here but it comes down to 1) Unload the .Net Standard Project, 2) Load and Edit your Storyboard, 3) Reload the .Net Standard project when done with the Storyboard. Not ideal, but an easy enough work-around to manage.

Edit: Microsoft has reported that the issue has now been fixed and it’s available in Visual Studio 2017 15.9.4

Tagged . Bookmark the permalink.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.