0
我有一個用戶控件,其中包含具有多個選項卡的選項卡項目。每個選項卡都包含一個具有相同按鈕的自定義堆棧面板(添加,更新,刪除)。我收到「指定的元素已經是另一個元素的邏輯子元素,先斷開它」的錯誤。我不確定如何斷開連接,因爲我已經設置了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">