Reputation: 71
I have found many solutions, but for old versions and other platforms, that don't work. Am using Xaramin Forms to have cross-platform usage.
Currently: portable project has all pictures in a folder called "Images". (eg. 'logo.png').
tried:
XAML: <Image x:Name="imgLogo" Source="/Images/logo.png"> - Not displayed
C#: imgLogo.Source = "/Images/logo.png"; - Not displayed either
Since it is only for appearance, not dynamic, XAML should be fine.
Also I'd like have the image clickable. So how should I wrap in a button?
What is the simplest way to have a few sliding images? I have a string array of filenames...
Upvotes: 0
Views: 7546
Reputation: 69
I think you are using absolute path.
Change to relative path.
ex :
<Image x:Name="imgLogo" Source="../Images/logo.png">
You can display image to your SW.
Upvotes: 0
Reputation: 7189
If you want to have Images within your PCL project, they need to be Embedded resources but you need to jump through some hoops to call them via XAML. Take a look at the Embedded Images section of the Images article on official Xamarin documentation.
<Image Source="{local:ImageResource WorkingWithImages.beach.jpg}" />
Regarding the sliding images, take a look at the CarouselView control that let's you swipe through (for example) a list of images.
Upvotes: 0