summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs')
-rw-r--r--Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs31
1 files changed, 31 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs b/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs
new file mode 100644
index 00000000..b7cdd8fb
--- /dev/null
+++ b/Xamarin.Forms.Controls/GalleryPages/ClipToBoundsGallery.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Xamarin.Forms.Controls
+{
+ public class ClipToBoundsGallery : ContentPage
+ {
+ public ClipToBoundsGallery ()
+ {
+ var child1 = new BoxView { Color = Color.Red };
+ var child2 = new BoxView { Color = Color.Blue };
+ var button = new Button { Text = "Clip", BackgroundColor = Color.Green };
+
+ Padding = new Thickness (55);
+ var layout = new AbsoluteLayout {
+ Children = {
+ {child1, new Rectangle (-50, 0, 100, 100)},
+ {child2, new Rectangle (0, -50, 100, 100)},
+ {button, new Rectangle (1.0, 0.5, 100, 100), AbsoluteLayoutFlags.PositionProportional}
+ }
+ };
+
+ button.Clicked += (sender, args) => layout.IsClippedToBounds = !layout.IsClippedToBounds;
+
+ Content = layout;
+ }
+ }
+}