2016-10-18 30 views
0

这是一个简单的问题,也许是愚蠢的,但我从小时卡住..Xamarin表格 - 资源字典和<系统:UINT32>价值

我有一个在XAML部分:

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

当然,有<System>类型的访问,我有这样一行:

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

不过,我有一个XAML解析异常。当我评论<System:Uint32...</System:Uint32>然后它工作。 #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是由系统来了,所以我要引用它像系统:UINT32是不是?

感谢您的帮助!

回答

1

它有点迟,但我会发布一个答案。您需要导入的类型应该是UInt32而不是Uint32,区分大小写。无论如何,如果你想将这个值绑定到一个保证金或类似的价值,你应该使用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>