From 4b9cd7d8b656745b7bd2ed3c7f2eeaa2d2e93151 Mon Sep 17 00:00:00 2001 From: David Britch Date: Wed, 8 Jul 2020 16:51:44 +0100 Subject: [PATCH 1/2] Initial Shapes support. --- .../FormsGallery.Android/MainActivity.cs | 2 +- .../FormsGallery/FormsGallery.UWP/App.xaml.cs | 2 +- .../FormsGallery.iOS/AppDelegate.cs | 2 +- .../CodeExamples/EllipseDemoPage.cs | 29 +++++++++++ .../FormsGallery/CodeExamples/LineDemoPage.cs | 29 +++++++++++ .../FormsGallery/CodeExamples/PathDemoPage.cs | 29 +++++++++++ .../CodeExamples/PolygonDemoPage.cs | 29 +++++++++++ .../CodeExamples/PolylineDemoPage.cs | 29 +++++++++++ .../CodeExamples/RectangleDemoPage.cs | 29 +++++++++++ .../FormsGallery/CodeExamplesMainPage.cs | 48 +++++++++++++++++++ .../FormsGallery/FormsGallery/HomePage.xaml | 30 ++++++++++++ .../XamlExamples/EllipseDemoPage.xaml | 13 +++++ .../XamlExamples/EllipseDemoPage.xaml.cs | 12 +++++ .../XamlExamples/LineDemoPage.xaml | 13 +++++ .../XamlExamples/LineDemoPage.xaml.cs | 12 +++++ .../XamlExamples/PathDemoPage.xaml | 13 +++++ .../XamlExamples/PathDemoPage.xaml.cs | 12 +++++ .../XamlExamples/PolygonDemoPage.xaml | 14 ++++++ .../XamlExamples/PolygonDemoPage.xaml.cs | 12 +++++ .../XamlExamples/PolylineDemoPage.xaml | 13 +++++ .../XamlExamples/PolylineDemoPage.xaml.cs | 12 +++++ .../XamlExamples/RectangleDemoPage.xaml | 13 +++++ .../XamlExamples/RectangleDemoPage.xaml.cs | 12 +++++ 23 files changed, 406 insertions(+), 3 deletions(-) create mode 100644 FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml.cs create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml create mode 100644 FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml.cs diff --git a/FormsGallery/FormsGallery/FormsGallery.Android/MainActivity.cs b/FormsGallery/FormsGallery/FormsGallery.Android/MainActivity.cs index 76168a24e3..057597f9a0 100644 --- a/FormsGallery/FormsGallery/FormsGallery.Android/MainActivity.cs +++ b/FormsGallery/FormsGallery/FormsGallery.Android/MainActivity.cs @@ -14,7 +14,7 @@ protected override void OnCreate(Bundle bundle) base.OnCreate(bundle); - Xamarin.Forms.Forms.SetFlags(new string[] {"SwipeView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental", "RadioButton_Experimental", "Expander_Experimental" }); + Xamarin.Forms.Forms.SetFlags(new string[] {"SwipeView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental", "RadioButton_Experimental", "Expander_Experimental", "Shapes_Experimental" }); global::Xamarin.Forms.Forms.Init(this, bundle); global::Xamarin.FormsMaps.Init(this, bundle); LoadApplication(new App()); diff --git a/FormsGallery/FormsGallery/FormsGallery.UWP/App.xaml.cs b/FormsGallery/FormsGallery/FormsGallery.UWP/App.xaml.cs index 9dab28c6a8..5136ab7557 100644 --- a/FormsGallery/FormsGallery/FormsGallery.UWP/App.xaml.cs +++ b/FormsGallery/FormsGallery/FormsGallery.UWP/App.xaml.cs @@ -58,7 +58,7 @@ protected override void OnLaunched(LaunchActivatedEventArgs e) rootFrame.NavigationFailed += OnNavigationFailed; - Xamarin.Forms.Forms.SetFlags(new string[] { "SwipeView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental", "RadioButton_Experimental", "Expander_Experimental" }); + Xamarin.Forms.Forms.SetFlags(new string[] { "SwipeView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental", "RadioButton_Experimental", "Expander_Experimental", "Shapes_Experimental" }); Xamarin.Forms.Forms.Init(e); Xamarin.FormsMaps.Init("MAP_KEY"); diff --git a/FormsGallery/FormsGallery/FormsGallery.iOS/AppDelegate.cs b/FormsGallery/FormsGallery/FormsGallery.iOS/AppDelegate.cs index 8acfee899a..972ca02409 100644 --- a/FormsGallery/FormsGallery/FormsGallery.iOS/AppDelegate.cs +++ b/FormsGallery/FormsGallery/FormsGallery.iOS/AppDelegate.cs @@ -18,7 +18,7 @@ public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsAppli // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { - Xamarin.Forms.Forms.SetFlags(new string[] { "SwipeView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental", "RadioButton_Experimental", "Expander_Experimental" }); + Xamarin.Forms.Forms.SetFlags(new string[] { "SwipeView_Experimental", "CarouselView_Experimental", "MediaElement_Experimental", "RadioButton_Experimental", "Expander_Experimental", "Shapes_Experimental" }); global::Xamarin.Forms.Forms.Init(); global::Xamarin.FormsMaps.Init(); LoadApplication(new App()); diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs new file mode 100644 index 0000000000..85f63d856c --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms; + +namespace FormsGallery.CodeExamples +{ + public class EllipseDemoPage : ContentPage + { + public EllipseDemoPage() + { + Label header = new Label + { + Text = "Ellipse", + FontSize = 50, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center + }; + + // Build the page. + Title = "Ellipse Demo"; + Content = new StackLayout + { + Children = + { + header + } + }; + } + } +} + diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs new file mode 100644 index 0000000000..49a100b5bf --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms; + +namespace FormsGallery.CodeExamples +{ + public class LineDemoPage : ContentPage + { + public LineDemoPage() + { + Label header = new Label + { + Text = "Line", + FontSize = 50, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center + }; + + // Build the page. + Title = "Line Demo"; + Content = new StackLayout + { + Children = + { + header + } + }; + } + } +} + diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs new file mode 100644 index 0000000000..ed0c5e6e2a --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms; + +namespace FormsGallery.CodeExamples +{ + public class PathDemoPage : ContentPage + { + public PathDemoPage() + { + Label header = new Label + { + Text = "Path", + FontSize = 50, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center + }; + + // Build the page. + Title = "Path Demo"; + Content = new StackLayout + { + Children = + { + header + } + }; + } + } +} + diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs new file mode 100644 index 0000000000..a630c031e0 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms; + +namespace FormsGallery.CodeExamples +{ + public class PolygonDemoPage : ContentPage + { + public PolygonDemoPage() + { + Label header = new Label + { + Text = "Polygon", + FontSize = 50, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center + }; + + // Build the page. + Title = "Polygon Demo"; + Content = new StackLayout + { + Children = + { + header + } + }; + } + } +} + diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs new file mode 100644 index 0000000000..67ec1eb71f --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms; + +namespace FormsGallery.CodeExamples +{ + public class PolylineDemoPage : ContentPage + { + public PolylineDemoPage() + { + Label header = new Label + { + Text = "Polyline", + FontSize = 50, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center + }; + + // Build the page. + Title = "Polyline Demo"; + Content = new StackLayout + { + Children = + { + header + } + }; + } + } +} + diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs new file mode 100644 index 0000000000..4cb05587d4 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs @@ -0,0 +1,29 @@ +using Xamarin.Forms; + +namespace FormsGallery.CodeExamples +{ + public class RectangleDemoPage : ContentPage + { + public RectangleDemoPage() + { + Label header = new Label + { + Text = "Rectangle", + FontSize = 50, + FontAttributes = FontAttributes.Bold, + HorizontalOptions = LayoutOptions.Center + }; + + // Build the page. + Title = "Rectangle Demo"; + Content = new StackLayout + { + Children = + { + header + } + }; + } + } +} + diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamplesMainPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamplesMainPage.cs index 705a725333..29521613f2 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamplesMainPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamplesMainPage.cs @@ -30,6 +30,14 @@ public CodeExamplesMainPage() CommandParameter = typeof(CodeExamples.BoxViewDemoPage) }, + new TextCell + { + Text = "Ellipse", + Detail = "Display an ellipse or circle", + Command = navigateCommand, + CommandParameter = typeof(CodeExamples.EllipseDemoPage) + }, + new TextCell { Text = "Expander", @@ -54,6 +62,14 @@ public CodeExamplesMainPage() CommandParameter = typeof(CodeExamples.LabelDemoPage) }, + new TextCell + { + Text = "Line", + Detail = "Display a line", + Command = navigateCommand, + CommandParameter = typeof(CodeExamples.LineDemoPage) + }, + new TextCell { Text = "Map", @@ -78,6 +94,38 @@ public CodeExamplesMainPage() CommandParameter = typeof(CodeExamples.OpenGLViewDemoPage) }, + new TextCell + { + Text = "Path", + Detail = "Display curves and complex shapes", + Command = navigateCommand, + CommandParameter = typeof(CodeExamples.PathDemoPage) + }, + + new TextCell + { + Text = "Polygon", + Detail = "Display a polygon", + Command = navigateCommand, + CommandParameter = typeof(CodeExamples.PolygonDemoPage) + }, + + new TextCell + { + Text = "Polyline", + Detail = "Display a series of connected straight lines", + Command = navigateCommand, + CommandParameter = typeof(CodeExamples.PolylineDemoPage) + }, + + new TextCell + { + Text = "Rectangle", + Detail = "Display a rectangle or square", + Command = navigateCommand, + CommandParameter = typeof(CodeExamples.RectangleDemoPage) + }, + new TextCell { Text = "WebView", diff --git a/FormsGallery/FormsGallery/FormsGallery/HomePage.xaml b/FormsGallery/FormsGallery/FormsGallery/HomePage.xaml index 1b4abcf13b..36143b0047 100644 --- a/FormsGallery/FormsGallery/FormsGallery/HomePage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/HomePage.xaml @@ -32,6 +32,11 @@ Command="{Binding NavigateCommand}" CommandParameter="{x:Type local:XamlExamples.BoxViewDemoPage}" /> + + + + + + + + + + + + + + + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml.cs b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml.cs new file mode 100644 index 0000000000..22f586a119 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace FormsGallery.XamlExamples +{ + public partial class EllipseDemoPage : ContentPage + { + public EllipseDemoPage() + { + InitializeComponent(); + } + } +} diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml new file mode 100644 index 0000000000..2533abc8b4 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml.cs b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml.cs new file mode 100644 index 0000000000..509ea27789 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace FormsGallery.XamlExamples +{ + public partial class LineDemoPage : ContentPage + { + public LineDemoPage() + { + InitializeComponent(); + } + } +} diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml new file mode 100644 index 0000000000..167514b78e --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml.cs b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml.cs new file mode 100644 index 0000000000..c2ef54aa1c --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace FormsGallery.XamlExamples +{ + public partial class PathDemoPage : ContentPage + { + public PathDemoPage() + { + InitializeComponent(); + } + } +} diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml new file mode 100644 index 0000000000..dc56bae54f --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml @@ -0,0 +1,14 @@ + + + + + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml.cs b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml.cs new file mode 100644 index 0000000000..0df0064593 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace FormsGallery.XamlExamples +{ + public partial class PolygonDemoPage : ContentPage + { + public PolygonDemoPage() + { + InitializeComponent(); + } + } +} diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml new file mode 100644 index 0000000000..cd665802d6 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml.cs b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml.cs new file mode 100644 index 0000000000..db2b8637f5 --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace FormsGallery.XamlExamples +{ + public partial class PolylineDemoPage : ContentPage + { + public PolylineDemoPage() + { + InitializeComponent(); + } + } +} diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml new file mode 100644 index 0000000000..fe092dbd0b --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml @@ -0,0 +1,13 @@ + + + + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml.cs b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml.cs new file mode 100644 index 0000000000..f23b53772a --- /dev/null +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml.cs @@ -0,0 +1,12 @@ +using Xamarin.Forms; + +namespace FormsGallery.XamlExamples +{ + public partial class RectangleDemoPage : ContentPage + { + public RectangleDemoPage() + { + InitializeComponent(); + } + } +} From af05523732a158f9e43473da95b036b1ef65ae8c Mon Sep 17 00:00:00 2001 From: David Britch Date: Thu, 9 Jul 2020 11:08:32 +0100 Subject: [PATCH 2/2] Shapes updates. --- .../CodeExamples/EllipseDemoPage.cs | 22 ++++++- .../FormsGallery/CodeExamples/LineDemoPage.cs | 14 ++++- .../FormsGallery/CodeExamples/PathDemoPage.cs | 63 ++++++++++++++++++- .../CodeExamples/PolygonDemoPage.cs | 25 +++++++- .../CodeExamples/PolylineDemoPage.cs | 23 ++++++- .../CodeExamples/RectangleDemoPage.cs | 22 ++++++- .../XamlExamples/EllipseDemoPage.xaml | 10 ++- .../XamlExamples/LineDemoPage.xaml | 7 ++- .../XamlExamples/PathDemoPage.xaml | 12 +++- .../XamlExamples/PolygonDemoPage.xaml | 6 +- .../XamlExamples/PolylineDemoPage.xaml | 4 +- .../XamlExamples/RectangleDemoPage.xaml | 10 ++- 12 files changed, 205 insertions(+), 13 deletions(-) diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs index 85f63d856c..13830561d2 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/EllipseDemoPage.cs @@ -1,4 +1,5 @@ using Xamarin.Forms; +using Xamarin.Forms.Shapes; namespace FormsGallery.CodeExamples { @@ -14,13 +15,32 @@ public EllipseDemoPage() HorizontalOptions = LayoutOptions.Center }; + Ellipse ellipse = new Ellipse + { + Fill = Color.Red, + WidthRequest = 150, + HeightRequest = 50, + HorizontalOptions = LayoutOptions.Center + }; + + Ellipse circle = new Ellipse + { + Stroke = Color.Red, + StrokeThickness = 4, + WidthRequest = 150, + HeightRequest = 150, + HorizontalOptions = LayoutOptions.Center + }; + // Build the page. Title = "Ellipse Demo"; Content = new StackLayout { Children = { - header + header, + ellipse, + circle } }; } diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs index 49a100b5bf..991f3f3b59 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/LineDemoPage.cs @@ -1,4 +1,5 @@ using Xamarin.Forms; +using Xamarin.Forms.Shapes; namespace FormsGallery.CodeExamples { @@ -14,13 +15,24 @@ public LineDemoPage() HorizontalOptions = LayoutOptions.Center }; + Line line = new Line + { + X1 = 40, + Y1 = 0, + X2 = 0, + Y2 = 120, + Stroke = Color.Red, + HorizontalOptions = LayoutOptions.Center + }; + // Build the page. Title = "Line Demo"; Content = new StackLayout { Children = { - header + header, + line } }; } diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs index ed0c5e6e2a..b4f87304ee 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PathDemoPage.cs @@ -1,4 +1,5 @@ using Xamarin.Forms; +using Xamarin.Forms.Shapes; namespace FormsGallery.CodeExamples { @@ -14,13 +15,73 @@ public PathDemoPage() HorizontalOptions = LayoutOptions.Center }; + Path path = new Path + { + Stroke = Color.Black, + Aspect = Stretch.Uniform, + HorizontalOptions = LayoutOptions.Center, + HeightRequest = 100, + WidthRequest = 100, + Data = new PathGeometry + { + Figures = new PathFigureCollection + { + new PathFigure + { + IsClosed = true, + StartPoint = new Point { X = 13.908992, Y = 16.207977 }, + Segments = new PathSegmentCollection + { + new LineSegment { Point = new Point { X = 32.000048, Y = 16.207977 } }, + new LineSegment { Point = new Point { X = 32.000049, Y = 31.999985 } }, + new LineSegment { Point = new Point { X = 13.908992, Y = 30.109983 } } + } + }, + new PathFigure + { + IsClosed = true, + StartPoint = new Point { X = 0, Y = 16.207977 }, + Segments = new PathSegmentCollection + { + new LineSegment { Point = new Point { X = 11.904009, Y = 16.207977 } }, + new LineSegment { Point = new Point { X = 11.904009, Y = 29.900984 } }, + new LineSegment { Point = new Point { X = 0, Y = 28.657984 } } + } + }, + new PathFigure + { + IsClosed = true, + StartPoint = new Point { X = 11.904036, Y = 2.0979624 }, + Segments = new PathSegmentCollection + { + new LineSegment { Point = new Point { X = 11.904036, Y = 14.202982 } }, + new LineSegment { Point = new Point { X = 2.7656555E-05, Y = 14.202982 } }, + new LineSegment { Point = new Point { X = 2.7656555E-05, Y = 3.3409645 } } + } + }, + new PathFigure + { + IsClosed = true, + StartPoint = new Point { X = 32.000058, Y = 0}, + Segments = new PathSegmentCollection + { + new LineSegment { Point = new Point { X = 32.000058, Y = 14.203001 } }, + new LineSegment { Point = new Point { X = 13.909059, Y = 14.203001 } }, + new LineSegment { Point = new Point { X = 13.909059, Y = 1.8890382 } } + } + } + } + } + }; + // Build the page. Title = "Path Demo"; Content = new StackLayout { Children = { - header + header, + path } }; } diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs index a630c031e0..5b3b820702 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolygonDemoPage.cs @@ -1,4 +1,5 @@ using Xamarin.Forms; +using Xamarin.Forms.Shapes; namespace FormsGallery.CodeExamples { @@ -14,13 +15,35 @@ public PolygonDemoPage() HorizontalOptions = LayoutOptions.Center }; + Polygon polygon = new Polygon + { + Points = new PointCollection + { + new Point { X = 0, Y = 48 }, + new Point { X = 0, Y = 144 }, + new Point { X = 96, Y = 150 }, + new Point { X = 100, Y = 0 }, + new Point { X = 192, Y = 0 }, + new Point { X = 192, Y = 96 }, + new Point { X = 50, Y = 96 }, + new Point { X = 48, Y = 192 }, + new Point { X = 150, Y = 200 }, + new Point { X = 144, Y = 48 } + }, + Fill = Color.Blue, + Stroke = Color.Red, + StrokeThickness = 3, + HorizontalOptions = LayoutOptions.Center + }; + // Build the page. Title = "Polygon Demo"; Content = new StackLayout { Children = { - header + header, + polygon } }; } diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs index 67ec1eb71f..b089a833d2 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/PolylineDemoPage.cs @@ -1,4 +1,5 @@ using Xamarin.Forms; +using Xamarin.Forms.Shapes; namespace FormsGallery.CodeExamples { @@ -14,13 +15,33 @@ public PolylineDemoPage() HorizontalOptions = LayoutOptions.Center }; + Polyline polyline = new Polyline + { + Points = new PointCollection + { + new Point { X = 0, Y = 0 }, + new Point { X = 10, Y = 30 }, + new Point { X = 15, Y = 0 }, + new Point { X = 18, Y = 60 }, + new Point { X = 23, Y = 30 }, + new Point { X = 35, Y = 30 }, + new Point { X = 40, Y = 0 }, + new Point { X = 43, Y = 60 }, + new Point { X = 48, Y = 30 }, + new Point { X = 100, Y = 30 } + }, + Stroke = Color.Red, + HorizontalOptions = LayoutOptions.Center + }; + // Build the page. Title = "Polyline Demo"; Content = new StackLayout { Children = { - header + header, + polyline } }; } diff --git a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs index 4cb05587d4..5d9bea29bb 100644 --- a/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs +++ b/FormsGallery/FormsGallery/FormsGallery/CodeExamples/RectangleDemoPage.cs @@ -1,4 +1,5 @@ using Xamarin.Forms; +using Rect = Xamarin.Forms.Shapes.Rectangle; namespace FormsGallery.CodeExamples { @@ -14,13 +15,32 @@ public RectangleDemoPage() HorizontalOptions = LayoutOptions.Center }; + Rect rectangle = new Rect + { + Fill = Color.Red, + WidthRequest = 150, + HeightRequest = 50, + HorizontalOptions = LayoutOptions.Center + }; + + Rect square = new Rect + { + Stroke = Color.Red, + StrokeThickness = 4, + WidthRequest = 150, + HeightRequest = 150, + HorizontalOptions = LayoutOptions.Center + }; + // Build the page. Title = "Rectangle Demo"; Content = new StackLayout { Children = { - header + header, + rectangle, + square } }; } diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml index 1b61ed8994..befe35a443 100644 --- a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/EllipseDemoPage.xaml @@ -8,6 +8,14 @@ FontSize="50" FontAttributes="Bold" HorizontalOptions="Center" /> - + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml index 2533abc8b4..6027c3dec2 100644 --- a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/LineDemoPage.xaml @@ -8,6 +8,11 @@ FontSize="50" FontAttributes="Bold" HorizontalOptions="Center" /> - + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml index 167514b78e..423eabbc84 100644 --- a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PathDemoPage.xaml @@ -8,6 +8,14 @@ FontSize="50" FontAttributes="Bold" HorizontalOptions="Center" /> - - + + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml index dc56bae54f..577b9a2ae5 100644 --- a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolygonDemoPage.xaml @@ -8,7 +8,11 @@ FontSize="50" FontAttributes="Bold" HorizontalOptions="Center" /> - + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml index cd665802d6..4b2f430fa5 100644 --- a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/PolylineDemoPage.xaml @@ -8,6 +8,8 @@ FontSize="50" FontAttributes="Bold" HorizontalOptions="Center" /> - + diff --git a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml index fe092dbd0b..b06dee62ec 100644 --- a/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml +++ b/FormsGallery/FormsGallery/FormsGallery/XamlExamples/RectangleDemoPage.xaml @@ -8,6 +8,14 @@ FontSize="50" FontAttributes="Bold" HorizontalOptions="Center" /> - + +