【问题标题】:need to set default assets or images folder需要设置默认资产或图像文件夹
【发布时间】:2015-09-23 08:53:32
【问题描述】:

有没有办法为 windows phone 的图像源设置默认路径?一些明显的变化?

我想写<Image Source="img1.png" /> 而不是<Image Source="Assets/Images/img1.png" />

实际上,此功能对 xamarin 开发人员非常有用。现在我需要在 xamarin studio 中创建这么一大段代码:

<Image>
        <Image.Source>
                        <OnPlatform x:TypeArguments="ImageSource">
                          <OnPlatform.iOS>
                            <FileImageSource File="img1.png"/>
                          </OnPlatform.iOS>
                          <OnPlatform.Android>
                            <FileImageSource File="img1.png"/>
                          </OnPlatform.Android>
                          <OnPlatform.WinPhone>
                            <FileImageSource File="Assets/Images/img1.png"/>
                          </OnPlatform.WinPhone>
                        </OnPlatform>
                      </Image.Source>
        </Image>

我的目标是把这段代码变成&lt;Image Source="img1.png"/&gt;

【问题讨论】:

    标签: wpf xaml windows-phone-8 xamarin windows-phone-8.1


    【解决方案1】:

    Windows Phone 是不可能的。如果你想使用

     <Image Source="img1.png"/> 
    

    图像必须位于项目的根目录。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-08-31
      • 2018-09-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多