Forum Xamarin.Forms

Announcement:

The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Images in subfolders?

Steve1000Steve1000 Member ✭✭✭

Hi i have lots of icons that i want to add to my project (e.g. 200 country flags etc.) i want put those icons in specific subfolders so it doesn't clutter the rest of the icons/images i have.

is there anyway to support this?

so
/Resources/flags on iOS
/Drawable/flags on Android

Or is there an alternative more efficient way to do this?

Tagged:

Best Answer

Answers

  • WendyZangWendyZang Member, Xamarin Team Xamurai
    Accepted Answer

    Have you try to use the Embedded images? This method of distributing images is recommended when identical images are used on each platform.

    For more details, you could refer to the link below. https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/images?tabs=windows

  • Steve1000Steve1000 Member ✭✭✭

    Hi - i can't seem to get this to work - I have created the following folder structure:

    Project > Resources > Images > Icons > icon.png

    Using the following XAML
    ImageSource="{helpers:ImageResource Project.Resources.Images.Icons.icon.png}"

    nothing is showing up. I've run this debug code as per the docs which does show the image path correctly, so not sure what is going wrong. I have cleaned the solution and also restarted VS and the iOS simulator with no luck.

  • Steve1000Steve1000 Member ✭✭✭

    Looks like the image control ImageSource was set to string updated that to use ImageSource property instead and it works

Sign In or Register to comment.