惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
有赞技术团队
有赞技术团队
博客园_首页
H
Help Net Security
GbyAI
GbyAI
aimingoo的专栏
aimingoo的专栏
V
Visual Studio Blog
The Cloudflare Blog
腾讯CDC
Jina AI
Jina AI
Last Week in AI
Last Week in AI
月光博客
月光博客
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
Blog — PlanetScale
Blog — PlanetScale
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
Y
Y Combinator Blog
Hugging Face - Blog
Hugging Face - Blog
博客园 - 聂微东
爱范儿
爱范儿
N
Netflix TechBlog - Medium
F
Fortinet All Blogs

博客园 - 阿冠

git报错unable to read tree xxxxxx socket tcp 报错误码 103/10053 原因 NuGet 未能为 SSL/TLS 安全通道建立信任关系 NuGet 未能为 SSL/TLS 安全通道建立信任关系 Visual Studio Font Cache 字体缓存路径下的文件太大了 ControlTemplate 中 Bingding 附加属性时需要加入 Path WPF使用第三方的字体(TTF文件) Base class for cloning an object in C# 关闭Windows 系统当前连接的Wifi以及判断物理\虚拟网卡,有线\无线网卡 - 阿冠 - 博客园 WPF 竖排文字 WPF 将DLL嵌入EXE文件(安装包) WPF 程序自删除(自毁)|卸载程序删除 WPF listbox UI虚拟化 记一次纠结Macbook 重装OS X的系统 无法将类型为“System.Windows.Controls.SelectedItemCollection”的对象强制转换为类型“System.Collections.Generic.IList`1 foreach---集合已修改;可能无法执行枚举操作。 WPF_View中控件使用单例ViewModel 判断s2是否能够被通过s1做循环移位(rotate)得到的字符串是否包含 多列转1列 SqlServer 实现oracle10g的 wmsys.wm_concat()--for xml path('')
指定的元素已经是另一个元素的逻辑子元素。请先将其断开连接...
阿冠 · 2015-10-23 · via 博客园 - 阿冠

起因:

<Window x:Class="WpfApplication1.Window3"   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="Window3" Height="300" Width="300">

    <Window.Resources>

        <Button Background="Blue"  Margin="5" Height="28" x:Key="prev">

            <Image Height="21" Source="Images\previous.gif"></Image>

        </Button>

    </Window.Resources>

    <Grid>

        <Button Height="20" Width="70" Content="Content" />

        <StaticResource ResourceKey="prev" />

    </Grid>
<!--第二次-->
     <Grid>

        <Button Height="20" Width="70" Content="Content" />

        <StaticResource ResourceKey="prev" />

    </Grid>

</Window>

报错:

指定的元素已经是另一个元素的逻辑子元素。请先将其断开连接

原因:当实例化的UserControl作为多个父类控件的Content内容时,如果不清除他与前一个父控件的关系,则会报此类错误。

解决方案:

在资源里面添加  x:Shared="False" 就可以了。

X:Shared用于指定请求资源时创建实例的两种方式。

X:Shared = “true”(默认):表示所有请求都是共享同一个实例。一般不显示指定。

X:Shared = “false”:表示每次请求都创建一个新的实例。

即:

<Window.Resources>

        <Button Background="Blue" X:Shared = “false” Margin="5" Height="28" x:Key="prev">

            <Image Height="21" Source="Images\previous.gif"></Image>

        </Button>

    </Window.Resources>

总结思路来源 http://bbs.csdn.net/topics/370036271
       http://www.cnblogs.com/zlgcool/archive/2008/10/18/1314281.html