Skip to content

ImageButton Padding not working when manipulate IsVisible On Android #16713

@muak

Description

@muak

Description

If IsVisible of the ImageButton or IsVisible of another View on the same level as the ImageButton changes, the Padding of the ImageButton is disabled.

<AbsoluteLayout>        

    <ImageButton
        AbsoluteLayout.LayoutFlags="PositionProportional"
        AbsoluteLayout.LayoutBounds="0.5,0.5,120,120"
        Source="dotnet_bot.png"
        WidthRequest="120"
        HeightRequest="120"
        CornerRadius="60"
        Padding="30"
        Aspect="AspectFit"                
        BackgroundColor="Beige"
        IsVisible="true"
        x:Name="imageButton"/>

    <ContentView
        AbsoluteLayout.LayoutFlags="SizeProportional"
        AbsoluteLayout.LayoutBounds="0,0,1.0,1.0"
        BackgroundColor="#80FFFFFF"
        IsVisible="true"
        x:Name="overlay"
        />
        
</AbsoluteLayout>
    public MainPage()
    {
        InitializeComponent();

        Dispatcher.DispatchDelayed(TimeSpan.FromSeconds(3), () =>
        {
            overlay.IsVisible = false;
            // workaround
            //this.ForceLayout();
        });
    }
Before After

Steps to Reproduce

  1. Arrenge an ImageView and any other View on the same parent layout .
  2. Manipulate IsVisibleProperty of either.
  3. ImageView Padding disabled.

Link to public reproduction project repository

https://github.com/muak/Maui.ImageButtonIssue

Version with bug

8.0.0-preview.7.8842

Is this a regression from previous behavior?

Yes, this used to work in Xamarin.Forms, Not sure, did not test other versions

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Android13

Did you find any workaround?

This can be avoided by calling Page's ForceLayout.

Relevant log output

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-controls-buttonButton, ImageButtonmigration-compatibilityXamarin.Forms to .NET MAUI Migration, Upgrade Assistant, Try-Convertplatform/androids/triagedIssue has been revieweds/verifiedVerified / Reproducible Issue ready for Engineering Triaget/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions