I'm having a similar issue to the one discussed here - Using Geometry resources in XAML - but I did not find answer there. I have a page in UWP, which looks like this:
<Page.Resources>
<GeometryGroup x:Key="Geometry">
<RectangleGeometry Rect="0 ,0 100 ,100"></RectangleGeometry>
<EllipseGeometry Center="150, 50" RadiusX="35" RadiusY="25"></EllipseGeometry>
</GeometryGroup>
</Page.Resources>
<Canvas x:Name="canMain" >
<Path Fill="Yellow" Stroke="Blue" Margin="5" Canvas.Top="10" Canvas.Left="10"
Data="{StaticResource Geometry}">
</Path>
<Path Fill="Green" Stroke="Blue" Margin="5" Canvas.Top="150" Canvas.Left="10"
Data="{StaticResource Geometry}">
</Path>
</Canvas>
The sample code is taken from a WPF book, where it's supposed to work. On UWP the app throws a run-time exception (meaning the app builds fine) of type Windows.UI.Xaml.Markup.XamlParseException with a message: "Failed to assign to property 'Windows.UI.Xaml.Shapes.Path.Data" The error points to this line:
<Path Fill="Yellow" Stroke="Blue" Margin="5" Canvas.Top="10" Canvas.Left="10"
Data="{StaticResource Geometry}">
In particular this piece Data="{StaticResource Geometry}" - do you have any ideas please? Thank you!
If I try this example, then it works. If I rewrite the example like this:
<Page.Resources>
<GeometryGroup x:Key="myGeometry">
<EllipseGeometry Center="50,50" RadiusX="50" RadiusY="50"/>
<RectangleGeometry Rect="0,0,100,100" />
</GeometryGroup>
</Page.Resources>
<Path Fill="Gold" Stroke="Black" StrokeThickness="1" Data="{StaticResource ResourceKey=myGeometry}">
</Path>
I get the same exception.