处理 Uid“%0”的属性时无法解析 属性“%1”
Unable to resolve property '%1' while processing properties for Uid '%0'
我正在尝试本地化我的 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
,那么一切正常。但是这个字符串在我的应用程序的另一部分中使用。
哪里会出问题?
UPD
我添加了类似于 the documentation 示例中的属性:
<data name="SampleProperty.Text" xml:space="preserve">
<value>Sample text</value>
</data>
<data name="SampleProperty.Width" xml:space="preserve">
<value>0</value>
</data>
一切正常。
但我不明白为什么这有效以及为什么第一种情况会出现异常...
不清楚您的示例中的 "SomeRandomKey" 是什么,以及您试图用它实现什么。
但是抛出这个异常是因为 TextBlocks 没有 SomeRandomKey 属性。
它们有 Text、Width,但绝对没有 "SomeRandomKey"。只需删除它。
我正在尝试本地化我的 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
,那么一切正常。但是这个字符串在我的应用程序的另一部分中使用。
哪里会出问题?
UPD
我添加了类似于 the documentation 示例中的属性:
<data name="SampleProperty.Text" xml:space="preserve">
<value>Sample text</value>
</data>
<data name="SampleProperty.Width" xml:space="preserve">
<value>0</value>
</data>
一切正常。 但我不明白为什么这有效以及为什么第一种情况会出现异常...
不清楚您的示例中的 "SomeRandomKey" 是什么,以及您试图用它实现什么。 但是抛出这个异常是因为 TextBlocks 没有 SomeRandomKey 属性。 它们有 Text、Width,但绝对没有 "SomeRandomKey"。只需删除它。