【问题标题】:How use static resources in xaml?如何在 xaml 中使用静态资源?
【发布时间】:2018-02-22 17:31:06
【问题描述】:

我想将我的 StringFormat 取出到静态资源中。

我试过了,但是没用

.. xmlns:system="clr-namespace:System;assembly=mscorlib">
    ResourceDictionary>
           <system:String x:Key="MyFormat">'http://www.gravatar.com/avatar/{0}?d=mm&amp;s=150'</system:String>
        </ResourceDictionary>

这里我初始化我的 StringFormat

 <Image.Source>
           <UriImageSource Uri="{Binding EmailHash,StringFormat={StaticResource MyFormat}}}" />
</Image.Source>

【问题讨论】:

    标签: c# xaml xamarin.forms


    【解决方案1】:

    您的StaticResouce 中似乎有单引号

    <system:String x:Key="MyFormat">http://www.gravatar.com/avatar/{0}?d=mm&amp;s=150</system:String>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-11
      相关资源
      最近更新 更多