Im trying to build a simply app to show an image in a stack layout, here's the code
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="HelloWorld.Page1">
<StackLayout BackgroundColor="White">
<Image Source="http://placehold.it/300x300"/>
</StackLayout>
</ContentPage>
but for some reason its not displaying the image at all. Can any of you see something wrong here.
Thanks!!
Possibly you don't have a well formed page?
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:QuickTestXAMLImage"
x:Class="QuickTestXAMLImage.MainPage">
<StackLayout BackgroundColor="White">
<Image Source="http://placehold.it/300x300"/>
</StackLayout>
</ContentPage>
Notice that I have a xmlns:local which include the local namespace of the app. It is possible you don't have a fully formed page that results in it not even loading correctly.
This works for me just fine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.