【发布时间】:2017-04-13 18:32:47
【问题描述】:
我使用 Xamarin Forms for Windows Phone 8.1(RT) 创建了应用程序。我将 XF 更新到最新版本 2.3.4.231。我的应用程序正在运行:
-windows phone 8.1 设备
-windows phone 8.1 模拟器
-手机模拟器10.0.14393(x86)
它工作正常。 但是当我在 Windows 10 设备(arm)上运行应用程序时,我有很多例外。我尝试不同的起始页面并获得鬃毛异常(来自 xaml):
-Cannot assign property \"ColumnDefinitions\": Property does not exists, or is not assignable, or mismatching type between value and property"
-StaticResource not found for key ...
-An item with the same key has already been added
所有这些错误都与 xaml 有关。 我不使用 XamlCompilationOptions.Compile。
我的应用的最新工作版本 XF 2.3.2.127
这个小例子: 我更改了起始页。我有例外:
-StaticResource not found for key StandardPadding
这是我页面的一部分:
<StackLayout Padding="{StaticResource StandardPadding}">
我在 App.xaml 中的资源:
<Application.Resources>
<ResourceDictionary>
<Thickness x:Key="StandardPadding">16</Thickness>
</ResourceDictionary>
</Application.Resources>
【问题讨论】:
-
你能分享你的 XAML 代码吗?
-
我在我的问题中添加了一个小例子
-
ColumnDefinitions 是 Grid 的一部分(基本上是 Grid.ColumnDefinitions) - 您需要为整个页面提供 XAML,以便我们查看它有什么问题 - 而不仅仅是一个小 sn- p.
-
这不是我的 xaml 的问题。这是我的项目和 Xamarin Forms(2.3.4.231) 的问题。我的代码在模拟器(8.1 和 10)中工作,但在 Windows 10 设备(arm)中不工作。当我降级到 XF 2.3.2.127 时,我的代码在 Windows 10 设备中工作。
-
可能是您忘记在 app.xaml.cs 中调用
InitializeComponent();了吗?
标签: xaml windows-phone-8.1 xamarin.forms win-universal-app