x:Shared="false" で共有リソースを使用しようとすると、Visual Studio 2010 の xaml デザイナーに次の例外が表示されます。
System.InvalidOperationException 指定された要素は、既に別の要素の論理的な子です。最初に切断します。
それを回避することは可能ですか (たとえば、共有オブジェクトの同じ作成を行う添付プロパティを実装することによって)?
サンプル xaml:
<Window.Resources>
<Image x:Key="SharedImage" x:Shared="false" Source="/Images/image.png" />
<Style x:Key="ImageButton" TargetType="{x:Type Button}">
<Setter Property="Content" Value="{StaticResource SharedImage}" />
</Style>
</Window.Resources>
<StackPanel>
<Button Style="{StaticResource ImageButton}" />
<Button Style="{StaticResource ImageButton}" />
</StackPanel>
このバグは Visual Studio 2012 で修正されていますか?