[Xamarin Forms 2.5] There is a space in the button. What is it?

JTOneJTOne USMember ✭✭

Hi guys, what was changed in the previous versions in a button?

Here is XAML:

    <StackLayout Orientation="Horizontal"
                       Margin="5, 0, 5, 0"
            <Button Text="TEST"
                    IsEnabled="{Binding IsBusy, Converter={c:NegateBooleanConverter}}"
                    HorizontalOptions="FillAndExpand" />

This is space exists in XF2.5sr1

The same button and the space does not exist on previous XF2.4.0.282 version

The biggest issue here is the space has a different size in iOS, UWP and Android!

Best Answer

  • JTOneJTOne US ✭✭
    edited November 2017 Accepted Answer

    Yes, it helps, thank you


  • MarlonRibeiroMarlonRibeiro USMember ✭✭✭
    edited November 2017

    That issue has already happened before (I don't rembember exactly which version of Xamarin.Forms).
    What you can do to fix that is to implement an empty ButtonRenderer for Android (I can't explain how, but it works).

        public class MarginlessButtonRenderer : ButtonRenderer
                protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.Button> e)
  • MarlonRibeiroMarlonRibeiro USMember ✭✭✭

    Ps: It only works if you set a background color for Button*

  • JTOneJTOne USMember ✭✭
    edited November 2017 Accepted Answer

    Yes, it helps, thank you

Sign In or Register to comment.