发现在.NET 4.0中的WPF有这么一个现象,
代码:
<
Viewbox
x:Key
="DelButtonContent"
Width
="18"
Height
="18"
x:Shared
="false"
Stretch
="None"
>
< Canvas Width ="18" Height ="18" >
< Rectangle Width ="18" Height ="6" Canvas.Left ="0" Canvas.Top ="6" Stretch ="Fill" StrokeLineJoin ="Round" Stroke ="#FF000000" Fill =" {StaticResource ButtonsFillBrush} " StrokeThickness ="0" />
</ Canvas >
</ Viewbox >
< Canvas Width ="18" Height ="18" >
< Rectangle Width ="18" Height ="6" Canvas.Left ="0" Canvas.Top ="6" Stretch ="Fill" StrokeLineJoin ="Round" Stroke ="#FF000000" Fill =" {StaticResource ButtonsFillBrush} " StrokeThickness ="0" />
</ Canvas >
</ Viewbox >
如果不设置x:Shared为false的话,在一个resourcedictionay中,超过2次引用该资源,则第三个引用无效。