【问题标题】:How can I put a BackgroundImage in Xamarin.Forms UWP?如何在 Xamarin.Forms UWP 中放置 BackgroundImage?
【发布时间】:2016-10-29 00:44:44
【问题描述】:

大家好。我目前正在创建我的 Xamarin.Forms 项目的 UWP 部分,并且我想在其中放置一个 BackgroundImage。我注意到我在 Xamarin.Forms.Droid 中使用的图像没有显示在我的 UWP 上。为什么呢?

我使用了这段代码 BackgroundImage="filename.jpg"

【问题讨论】:

    标签: xaml xamarin xamarin.forms uwp uwp-xaml


    【解决方案1】:

    检查图像并确保将图像放置在应用程序的根目录中,并使用Build Action: Content


    编辑:

    我建议你修改代码为:

    BackgroundImage="//Assets/filename.jpg"
    

    【讨论】:

    • 先生,我在哪里可以找到应用程序的根目录?我已将图像添加到 UWP 的 Assets 文件夹中。
    • 将图像放入 uwp 项目中。右键单击 UWP 项目 -> 添加现有项目 -> 添加您的图像
    • 我遇到了同样的问题,我的背景图片在 Android 上显示,但在 UWP 上不显示。我在 MainPage.xaml 中使用 backgroundImage="background1"。我将图像放在 Android 的资源中,将更大的图像放在 UWP 的 Assets 文件夹中。我还将构建操作设置为内容并复制到输出目录 = 如果更新则复制
    猜你喜欢
    • 2015-07-04
    • 2016-10-19
    • 2019-10-09
    • 2016-10-27
    • 1970-01-01
    • 2017-02-14
    • 2017-03-03
    • 1970-01-01
    • 2017-09-14
    相关资源
    最近更新 更多