将图像放置在Xamarin表单应用程序的位置

问题描述:

我正在使用Xamarin开发适用于Android,iOS和Visual Studio的应用程序

I am developing an application for Android, iOS and Visual Studio using Xamarin

我在xaml中添加了以下几行以使用图片:

I added the following lines in xaml to use images:

<Image Source="header.png" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" />
<Button x:Name="Object_Detection" Image="header.png" />

第一个用于显示标题中的图像,第二个用于显示按钮图标.他们链接到同一张图片"header.png"

The first is for displaying an image in the header and the second is for displaying a button icon. They link for the same image "header.png"

我将图片放在以下位置: -Mobile.Droid \ Resources \ drawable -Mobile.iOS \资源 -Mobile.Windows \ Assets

I put the image under: - Mobile.Droid\Resources\drawable - Mobile.iOS\Resources -Mobile.Windows\Assets

但是Windows 8.1应用程序中根本没有显示图像. 图片尺寸为690 * 79.

But the image is not shown at all in the Windows 8.1 app. the image size is 690*79.

如何解决该问题?

感谢您的所有帖子,

解决方案是将图像资源直接添加到根目录下的Windows子项目中.

the solution was to add the image resource to the windows sub-project directly under the root.

应该使用Visual Studio进行添加,以便编译器可以考虑图像.

The addition should be made using visual studio so that the image will be taken in consideration by the compiler.