在 xaml 中为 Windows Phone 使用原始类型 8.1

Using primitive types in xaml for Windows Phone 8.1

在将 Windows Phone 8.1 (Silverlight) 应用程序转换为 Windows Phone 8.1 应用程序时,我在加载应用程序时遇到崩溃。

我将问题缩小到 App.xaml 中的全局资源声明。

<Application
    x:Class="MyApp.App"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:System="using:System">

    <Application.Resources>        
        <System:Double x:Key="PhoneFontSizeSmall">18.667</System:Double>
    </Application.Resource>

如果我注释掉 System:Double 资源,应用程序是 运行。

我尝试使用 previous? 方式更改引用声明,例如

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

但是有人抱怨在构建期间无法在命名空间中找到 Double...

更多信息,App.Initialization期间抛出的异常如下。

{Windows.UI.Xaml.UnhandledExceptionEventArgs}
    Exception: {"The text associated with this error code could not be found.\r\n\r\nCannot deserialize XBF metadata type list as '%1' was not found in namespace '%0'. [Line: 0 Position: 0]"}
    Handled: false
    Message: "Cannot deserialize XBF metadata type list as '%1' was not found in namespace '%0'. [Line: 0 Position: 0]"
    Native View: To inspect the native object, enable native code debugging.

我在这里摸不着头脑,Google/Bing 到目前为止没有帮助。

使用'x'命名空间

<x:Double x:Key="PhoneFontSizeSmall">18.667</x:Double>