Skip to content

Commit

Permalink
Add support for Path.Data from string and resources
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromelaban committed Mar 19, 2019
1 parent ae8c725 commit 25ee3cc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
7 changes: 7 additions & 0 deletions src/SourceGenerators/XamlGenerationTests/PathTest.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
d:DesignHeight="300"
d:DesignWidth="400">

<UserControl.Resources>
<x:String x:Key="myPath">M 10,100.5 C 10,300 300,-200 300,100 Z</x:String>
</UserControl.Resources>

<Grid>
<Path Stroke="Black"
Fill="Gray"
Data="{StaticResource myPath}" />
<Path Stroke="Black"
Fill="Gray"
Data="M 10,100.5 C 10,300 300,-200 300,100 Z" />
Expand Down
5 changes: 5 additions & 0 deletions src/Uno.UI/UI/Xaml/Media/Geometry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public Geometry()
InitializeBinder();
}

public static implicit operator Geometry(string path)
{
return Parsers.ParseGeometry(path, CultureInfo.InvariantCulture);
}

#region Transform

public Transform Transform
Expand Down
11 changes: 0 additions & 11 deletions src/Uno.UI/UI/Xaml/Media/Geometry.wasm.cs

This file was deleted.

0 comments on commit 25ee3cc

Please sign in to comment.