Silverlight App.xaml中的“元素已经是另一个元素的子元素”错误

Silverlight App.xaml中的“元素已经是另一个元素的子元素”错误,第1张

概述我的App.xaml文件中出现了一个奇怪的错误: Element is already the child of another element. 我的App.xaml文件如下所示: <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http:// 我的App.xaml文件中出现了一个奇怪的错误:

Element is already the child of another element.

我的App.xaml文件如下所示:

<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"              x:Class="Celerior.Annapurna.SL.App">    <Application.Resources>        <ResourceDictionary>            <ResourceDictionary.MergedDictionarIEs>                <ResourceDictionary Source="ProvisiorResourceDictionary.xaml"/>            </ResourceDictionary.MergedDictionarIEs>        </ResourceDictionary>    </Application.Resources></Application>

报告整个ResourceDictionary元素的错误(从第5行到第9行).

ProvisiorResourceDictionary.xaml包含许多样式和模板.在我看来没什么好激动的.

有谁知道什么是错的?

亲切的问候,

罗纳德威尔登伯格

解决方法 由于AnthonyWJones的评论中提供的提示,我自己找到了问题的原因.

看来Silverlight resource dictionary中的所有内容都必须是可共享的.原因是资源字典中的项目(可能)将添加到控件层次结构中的多个位置.

我的资源字典中有两个不可共享的项目.

编辑:在WPF中,您可以在资源字典中的对象上使用x:Shared属性来强制WPF为每个资源检索创建新实例.不幸的是,Silverlight does not support这个属性.

总结

以上是内存溢出为你收集整理的Silverlight App.xaml中的“元素已经是另一个元素的子元素”错误全部内容,希望文章能够帮你解决Silverlight App.xaml中的“元素已经是另一个元素的子元素”错误所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/web/1002803.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-22
下一篇2022-05-22

发表评论

登录后才能评论

评论列表(0条)

    保存