Button with Image Xamarin.Forms

11,835

You can't nest the images in folders. iOS and Android expect them to be resources, and WP expects them to be in the App's root folder.

The Xamarin Forms docs has a section on working with images.

Share:
11,835
nix86
Author by

nix86

Updated on June 04, 2022

Comments

  • nix86
    nix86 about 2 years

    I'm developing a cross pltform app with Xamarin.Forms. I want to make a button with an image but I dont know how to specify the path of the imge. When I use this annotation it works:

    <Button Text="Naviga tra i Piani del Museo" Image="foo.png"/>
    

    but when my image is inside some folders (folder1/folder2) the following code doesn't work:

    <Button Text="Naviga tra i Piani del Museo" Image="folder1/folder2/foo.png"/>
    

    So how can I correctly specify the path of my image?