diff options
Diffstat (limited to 'Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21368.cs')
-rw-r--r-- | Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21368.cs | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21368.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21368.cs new file mode 100644 index 00000000..88d9d2ac --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla21368.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Xamarin.Forms.CustomAttributes; + +namespace Xamarin.Forms.Controls.TestCasesPages +{ + [Preserve (AllMembers=true)] + [Issue (IssueTracker.Bugzilla, 21368, "Button text alignment breaks if the buttons are in a stack layout inside another layout and the button is clicked", PlatformAffected.Android)] + public class Bugzilla21368 : ContentPage + { + ScrollView _scrollView; + StackLayout _buttonsStack; + Grid _buttonsGrid; + + public Bugzilla21368 () + { + _scrollView = new ScrollView { + Orientation = ScrollOrientation.Horizontal, + Content = new StackLayout { + Orientation = StackOrientation.Horizontal + }, + HeightRequest = 100 + }; + + _buttonsGrid = new Grid { + RowSpacing = 10 + }; + + _buttonsGrid.Children.Add (_scrollView, 0, 0); + _buttonsGrid.Children.Add (new Button { + Text = "Add Control", + Command = new Command (OnAddControl), + WidthRequest=400 + }, 0, 1); + _buttonsGrid.Children.Add (new Button { + Text = "Insert Control", + Command = new Command (OnInsertControl) + }, 0, 2); + _buttonsGrid.Children.Add (new Button { + Text = "Remove Control", + Command = new Command (OnRemoveControl) + }, 0, 3); + _buttonsStack = new StackLayout { Children = { _buttonsGrid } }; + + Content = new StackLayout { + Orientation = StackOrientation.Vertical, + Children = + { + _buttonsStack + } + }; + } + + StackLayout ScrollStackLayout + { + get { return (StackLayout) _scrollView.Content; } + } + + void OnAddControl () + { + ScrollStackLayout.Children.Add (new Button { Text = "hello" }); + ForceRelayout (); + } + + void OnInsertControl () + { + ScrollStackLayout.Children.Insert (0, new Button { + Text = "hello" + }); + ForceRelayout (); + } + + void OnRemoveControl () + { + if (ScrollStackLayout.Children.Count > 0) { + ScrollStackLayout.Children.RemoveAt (0); + ForceRelayout (); + } + } + + void ForceRelayout () + { + ScrollStackLayout.ForceLayout (); + _scrollView.ForceLayout (); + } + } +}
\ No newline at end of file |