diff options
author | E.Z. Hart <hartez@gmail.com> | 2016-03-22 17:16:53 -0600 |
---|---|---|
committer | E.Z. Hart <hartez@gmail.com> | 2016-03-30 16:22:35 -0600 |
commit | 17e2a4b94d5105b53c5875d9416d043f14313305 (patch) | |
tree | 6f03e5d6f562f230ed79d2e820327fe0bddc5069 /Xamarin.Forms.Controls.Issues | |
parent | b3a64fadb3951d4e5e65b5f000a5f930772c01ed (diff) | |
download | xamarin-forms-17e2a4b94d5105b53c5875d9416d043f14313305.tar.gz xamarin-forms-17e2a4b94d5105b53c5875d9416d043f14313305.tar.bz2 xamarin-forms-17e2a4b94d5105b53c5875d9416d043f14313305.zip |
Add options for specifying layout of button text/image content
Also make the layout and layout defaults consistent across platforms
Diffstat (limited to 'Xamarin.Forms.Controls.Issues')
4 files changed, 105 insertions, 0 deletions
diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs new file mode 100644 index 00000000..4f01a63d --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417.cs @@ -0,0 +1,59 @@ +using Xamarin.Forms.CustomAttributes; + +namespace Xamarin.Forms.Controls.Issues +{ + [Preserve(AllMembers = true)] + [Issue(IssueTracker.Bugzilla, 27417, + "Button.Image behaviors differently on each platform and has extra padding even with no Text", PlatformAffected.All)] + public class Bugzilla27417 : TestContentPage + { + protected override void Init() + { + var instructions = new Label { Text = @"There should be 6 buttons below. +The first button should have the text 'Click Me' in the center. +The second button should have an image in the center and no text. +The third button should have the image on the left and the text on the right. +The fourth button should have the image on the top and the text on the bottom. +The fifth button should have the image on the right and the text on the left. +The sixth button should have the image on the bottom and the text on the top." }; + + Content = new StackLayout + { + Spacing = 10, + Children = + { + instructions, + new ScrollView + { + Content = new StackLayout + { + Spacing = 10, + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = LayoutOptions.Center, + Children = + { + new Button { Text = "Click Me", BackgroundColor = Color.Gray }, + new Button { Image = "coffee.png", BackgroundColor = Color.Gray }, + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 10)), + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Top, 10)), + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Bottom, 10)), + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 10)) + } + } + } + } + }; + } + + static Button CreateButton(Button.ButtonContentLayout layout) + { + return new Button + { + Text = "Click Me", + Image = "coffee.png", + ContentLayout = layout, + BackgroundColor = Color.Gray + }; + } + } +}
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml new file mode 100644 index 00000000..ab652b30 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" ?> +<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" + xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" + x:Class="Xamarin.Forms.Controls.Issues.Bugzilla27417Xaml"> + <StackLayout Spacing="10"> + + <Button BackgroundColor="Color.Gray" Text="Click Me"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Top,10"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Bottom,10"></Button> + <Button BackgroundColor="Color.Gray" Image="coffee.png" Text="Click Me" ContentLayout="Right"></Button> + + </StackLayout> +</ContentPage>
\ No newline at end of file diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml.cs b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml.cs new file mode 100644 index 00000000..96d2ac45 --- /dev/null +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla27417Xaml.xaml.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +using Xamarin.Forms; + +namespace Xamarin.Forms.Controls.Issues +{ + public partial class Bugzilla27417Xaml : ContentPage + { + public Bugzilla27417Xaml () + { +#if APP + InitializeComponent (); +#endif + } + } +} diff --git a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems index 0a2d251b..6ae60c78 100644 --- a/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems +++ b/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Xamarin.Forms.Controls.Issues.Shared.projitems @@ -24,6 +24,11 @@ <Compile Include="$(MSBuildThisFileDirectory)Bugzilla26501.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla26868.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla27378.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla27417.cs" /> + <Compile Include="$(MSBuildThisFileDirectory)Bugzilla27417Xaml.xaml.cs"> + <DependentUpon>Bugzilla27417Xaml.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla27581.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla28570.cs" /> <Compile Include="$(MSBuildThisFileDirectory)Bugzilla28796.cs" /> @@ -485,4 +490,10 @@ <Generator>MSBuild:UpdateDesignTimeXaml</Generator> </EmbeddedResource> </ItemGroup> + <ItemGroup> + <EmbeddedResource Include="$(MSBuildThisFileDirectory)Bugzilla27417Xaml.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:UpdateDesignTimeXaml</Generator> + </EmbeddedResource> + </ItemGroup> </Project>
\ No newline at end of file |