For my Windows Phone 8.1 app, I'm trying to make icons available as static resources by putting them into my XAML page's ResourceDictionary
:
<phone:PhoneApplicationPage.Resources>
<ResourceDictionary>
<Path x:Name="MyIcon" Width="38" Height="31.6667" Fill="{StaticResource PhoneForegroundBrush}" Data="..."/>
</ResourceDictionary>
</phone:PhoneApplicationPage.Resources>
When I try to use MyIcon
inside a button from code-behind...
Button buyButton = new Button { Content = MyIcon };
...an ArgumentException
is thrown at this line: Value does not fall within the expected range.
When referencing MyIcon
directly in XAML, it appears correctly in the visual editor, but causes an XAMLParseException
while the page is loading.
Am I doing something wrong or is using control objects as static resources just not possible?