【问题标题】:Xamarin Forms - ResourceDictionary and <System:Uint32> valueXamarin 表单 - ResourceDictionary 和 <System:Uint32> 值
【发布时间】:2016-10-18 01:38:41
【问题描述】:

这是一个简单的问题,也许很愚蠢,但我被困了几个小时......

我在 XAML 部分中有这个:

<ContentPage.Resources>
  <ResourceDictionary>
    <System:Uint32 x:Key="UintValue">50</System:Uint32>
  </ResourceDictionary>
</ContentPage.Resources>

当然,要获得&lt;System&gt; 类型的访问权限,我有这行:

xmlns:System="clr-namespace:System;assembly=mscorlib"

但是,我有一个 XAML 解析异常。当我评论 &lt;System:Uint32...&lt;/System:Uint32&gt; 时,它可以工作。 #ButIDontHaveTheValue..

There is a link to the doc of Uint

Type | Range              | Size                    | .NET Framework type
uint | 0 to 4,294,967,295 | Unsigned 32-bit integer | System.UInt32

所以如果我是对的,那么 Uint32 来自 System,所以我必须像 System:Uint32 一样引用它?

感谢您的帮助!

【问题讨论】:

    标签: xaml uint64 uint32 uint


    【解决方案1】:

    有点晚了,但无论如何我都会发布答案。您需要导入的类型应该是UInt32 而不是Uint32,区分大小写。无论如何,如果您想将此值绑定到 Margin 或类似值,则应使用 String 代替,因为它们可以采用更多由冒号分隔的整数,并且它们是字符串。

    <ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    xmlns:System="clr-namespace:System;assembly=mscorlib">
    ...
    <System:UInt32 x:Key="sdsd">15</System:UInt32>
    ...
    </ContentPage>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-12
      • 1970-01-01
      • 1970-01-01
      • 2016-12-26
      • 2023-03-12
      • 1970-01-01
      相关资源
      最近更新 更多