From 53a0551c0c25e0759f3e76ebd4d413d0c4daf9ce Mon Sep 17 00:00:00 2001 From: Pavel Yakovlev Date: Mon, 14 May 2018 18:19:43 +0300 Subject: [PATCH] [iOS, Android, UWP] Added padding to Button control (#2426) Fixes #1702 --- .../GitHub1702.cs | 165 ++++++++++++++++++ ...rin.Forms.Controls.Issues.Shared.projitems | 1 + .../CoreGalleryPages/ButtonCoreGalleryPage.cs | 7 + Xamarin.Forms.Core/Button.cs | 20 ++- .../TestAttributes.cs | 1 + .../AppCompat/ButtonRenderer.cs | 30 +++- .../FastRenderers/ButtonRenderer.cs | 32 +++- .../Renderers/ButtonRenderer.cs | 32 +++- Xamarin.Forms.Platform.UAP/ButtonRenderer.cs | 17 ++ .../Renderers/ButtonRenderer.cs | 31 +++- 10 files changed, 321 insertions(+), 15 deletions(-) create mode 100644 Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1702.cs diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1702.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1702.cs new file mode 100644 index 000000000..b95aa6234 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/GitHub1702.cs @@ -0,0 +1,165 @@ +using Xamarin.Forms.CustomAttributes; +using Xamarin.Forms.Internals; +using System; +using System.Linq; +using System.Threading; +using System.Collections.Generic; + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Github, 1702, "[Enhancement] Padding on Buttons", PlatformAffected.All)] + public class GitHub1702 : TestContentPage + { + bool animation = false; + + protected override void Init() + { + StackLayout layout = new StackLayout() + { + Children = + { + new Button() + { + Image = "coffee.png", + BackgroundColor = Color.GreenYellow, + Text = "No padding? Height 100", + HeightRequest = 100, + }, + new Button() + { + Image = "coffee.png", + BackgroundColor = Color.Green, + Padding = new Thickness(100, 0, 0, 0), + Text = "Do I have left padding? I should have left padding.", + }, + new Button() + { + Image = "coffee.png", + BackgroundColor = Color.LawnGreen, + Padding = new Thickness(0, 30, 0, 0), + Text = "Do I have top padding? I should have top padding." + }, + new Button() + { + Image = "coffee.png", + BackgroundColor = Color.LightGreen, + Padding = new Thickness(0, 0, 100, 0), + Text = "Do I have right padding? I should have right padding." + }, + new Button() + { + Image = "coffee.png", + BackgroundColor = Color.ForestGreen, + Padding = new Thickness(0, 0, 0, 30), + Text = "Do I have bottom padding? I should have bottom padding." + } + } + }; + + var buttons = layout.Children.OfType