I am trying to design a set of icons in a Silverlight 4 User Control's ressources, and then display these on a button.
I have
<UserControl.Resources>
<Rectangle x:Key="Icon1" Fill="Black" Width="10" Height="10" />
</UserControl.Resources>
and
<Button x:Name="Button1"
Width="50" Height="50"
Content="{Binding Source={StaticResource Icon1}}" />
I also tried ... Content="{StaticResource Icon1}"
. Both show fine in the XAML Designer of VS 2010, but fail when I try to run it with a XAMLParseException. The first one complains about the argument not falling into the expected range, the second one simply says "Failed to assign property". Copying the Rectangle into the Buttons content directly works fine.
Where is the problem? I thought I finally understood this.. =/