Zakariah Siyaji
Zakariah Siyaji

Reputation: 1129

BackgroundImage() in Xamarin for cross platform mobile design not working

Systems: Windows 10, Visual Studios, Xamarin, Cross platform Mobile Design, Xamarin Live app on iPhone X.

Inside of my MainPage.xaml file, I added the following code:

BackgroundImage="Users\Zakariah Siyaji\Desktop\3840X2160-HDR-Wallpaper-1.jpg"

Without this line, my code compiles and runs correctly. With this line of code, I do not receive errors; in fact, the output window displays: "Deploy to iPhone Player succeeded." But, the Xamarin Live App crashes on the iPhone X. I am having trouble displaying a background image to my carousel page. Is there a fix that I am missing? Do I need additional code?

Upvotes: 0

Views: 142

Answers (2)

Ronak Shetiya
Ronak Shetiya

Reputation: 980

you cannot access your local pc files from mobile phone, if you need a background image, then Add it to drawable for android and for ios add it to assets folder under Resources folder. later you can access it by using

BackgroundImage="image.png";

Upvotes: 2

François
François

Reputation: 3274

Your phone cannot access your computer file system.

Upvotes: 0

Related Questions