I have the following code in a Xamarin Form (v1.3.4.6332) Xamarin VS Extension (v3.9.344):
<Image Grid.Row="1" Grid.Column="0">
<Image.Source>
<OnPlatform x:TypeArguments="ImageSource">
<OnPlatform.iOS>
<FileImageSource File="Icons/AppAlert.png"/>
</OnPlatform.iOS>
<OnPlatform.Android>
<FileImageSource File="appalert.png"/>
</OnPlatform.Android>
<OnPlatform.WinPhone>
<FileImageSource File="Assets/Icons/AppAlert.png"/>
</OnPlatform.WinPhone>
</OnPlatform>
</Image.Source>
</Image>-->
It works fine on both iOS and Android but the image is never display on the WinPhone. The image is set to content. I have moved the image to the root folder on the WinPhone project and it still does show. I then tried the following code:
<Image x:Name="AlertImage" Grid.Row="1" Grid.Column="0" Source="Assets/Icons/AppAlert.png" />
Again no joy. Finally I put the following code in the code behind file:
AlertImage.Source = Device.OnPlatform(iOS: ImageSource.FromFile("Icons/AppAlert.png"), Android: ImageSource.FromFile("appalert.png"), WinPhone: ImageSource.FromFile("Assets/Icons/AppAlert.png"));
and the image now shows on the WinPhone.
Is this a bug or am I doing something wrong?