我有一个用户控件,其中包含一个带有多个选项卡的选项卡项。每个选项卡都包含一个带有相同按钮(添加、更新、删除)的自定义堆栈面板。我收到“指定元素已经是另一个元素的逻辑子元素。首先断开它”错误。我不知道该怎么做才能断开它,因为我已经x:Shared = "False"
设置了元素。
内部 Grid.Resource:
<!--ButtonAddImage-->
<Image x:Key="ButtonAddImage"
x:Shared="True">
<Image.Style>
<Style TargetType="{x:Type Image}">
<Setter Property="Source"
Value="add2_32.png" />
<Setter Property="Stretch"
Value="Uniform" />
</Style>
</Image.Style>
</Image>
<!--ButtonAddStyle-->
<Style TargetType="Button"
x:Key="ButtonAddStyle"
x:Shared="False">
<Setter Property="Content"
Value="{DynamicResource ResourceKey=ButtonAddImage}" />
<Setter Property="Width"
Value="32" />
<Setter Property="Height"
Value="22" />
<Setter Property="HorizontalAlignment"
Value="Left" />
<Setter Property="VerticalAlignment"
Value="Center" />
</Style>
内部选项卡:
<Button Style="{DynamicResource ResourceKey=ButtonAddStyle}"
Name="gdSMSInfo_btnAddRecord"
Click="gdSMSInfo_btnAddRecord_Click">