无法解析属性'%1'同时处理Uid '%0'的属性

本文关键字:属性 处理 Uid | 更新日期: 2023-09-27 17:54:29

我正在尝试本地化我的WP 8.1应用程序。

这是Strings/en-us/Resources.resw的一部分:

<data name="SampleProperty.Text" xml:space="preserve">
    <value>Sample text</value>
</data>
<data name="SampleProperty.SomeRandomKey" xml:space="preserve">
    <value>SAMPLE TEXT</value>
</data>

还有一个应用程序页面包含以下代码:

<TextBlock x:Uid="SampleProperty" />

但是应用程序在导航到该页的过程中抛出了一个异常:

WinRT information: Unable to resolve property '%1' while processing properties for Uid '%0'. [Line: 167 Position: 24]
Additional information: The text associated with this error code could not be found.

如果我从资源字典中删除SampleProperty.SomeRandomKey,那么一切工作正常。但是这个字符串在我的应用程序的另一部分使用。

问题出在哪里?

乌利希期刊指南

我已经添加了像文档样例中的属性:

<data name="SampleProperty.Text" xml:space="preserve">
    <value>Sample text</value>
</data>
<data name="SampleProperty.Width" xml:space="preserve">
    <value>0</value>
</data>

一切正常。但我不明白为什么这是工作的,为什么第一个情况给出了异常…

无法解析属性'%1'同时处理Uid '%0'的属性

在您的示例中不清楚"SomeRandomKey"是什么,以及您试图用它实现什么。但是这个异常被抛出是因为textblock没有SomeRandomKey属性。他们有文本,宽度,但绝对没有"SomeRandomKey"。