Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Image layout problem - can spill out into surrounding UI #14926

Closed
RobTF opened this issue May 4, 2023 · 4 comments · Fixed by #17120
Closed

iOS: Image layout problem - can spill out into surrounding UI #14926

RobTF opened this issue May 4, 2023 · 4 comments · Fixed by #17120
Assignees
Labels
area-controls-image Image control area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter delighter fixed-in-8.0.0-rc.2.9511 Look for this fix in 8.0.0-rc.2.9511 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@RobTF
Copy link

RobTF commented May 4, 2023

Description

I attempted to create a UI which contained an element that has a button either side, with an image in the center.

I tried two different ways of doing this,

Using a grid;

        <Grid ColumnDefinitions="Auto,*,Auto" Margin="10">
            <Button
                Clicked="LeftClicked"
                VerticalOptions="Center"
                Margin="15,0,0,0"
                Text="One" />
            <Image
                BackgroundColor="Green"
                Grid.Column="1"
                HeightRequest="76"
                HorizontalOptions="Center"
                Source="logo_dark.png" />
            <Button
                Clicked="RightClicked"
                Margin="0,0,15,0"
                VerticalOptions="Center"
                Grid.Column="2"
                Text="Two" />
        </Grid>

Using an AbsoluteLayout;

            <AbsoluteLayout>
                <Button
                    AbsoluteLayout.LayoutBounds="0,0.5,-1,-1"
                    AbsoluteLayout.LayoutFlags="PositionProportional"
                    Clicked="LeftClicked"
                    Margin="15,0,0,0"
                    Text="One" />
                <Image
                    BackgroundColor="Green"
                    AbsoluteLayout.LayoutFlags="PositionProportional"
                    AbsoluteLayout.LayoutBounds="0.5,0.5,-1,-1"
                    HeightRequest="76"
                    Source="logo_dark.png" />
                <Button
                    Clicked="RightClicked"
                    Margin="0,0,15,0"
                    AbsoluteLayout.LayoutFlags="PositionProportional"
                    AbsoluteLayout.LayoutBounds="1,0.5,-1,-1"
                    Text="Two" />
            </AbsoluteLayout>

Both of these work on Android;
android

Both fail to render correctly on iOS - note how the image goes full width and overlaps the left button due to element order/Z-index
ios

Steps to Reproduce

  1. Build and run example project on iOS
  2. Observe issue

Link to public reproduction project repository

https://github.com/RobTF/mauiplay/tree/master/ImageGridIssue

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16

Did you find any workaround?

For the grid version, removing HorizontalLayout="Center" constrains the image to the correct area of the grid.

For the absolute layout version, adding WidthRequest can solve the issue, but the width must be manually calculated ahead of time, based on the height vs. aspect ratio of the image.

Relevant log output

None.
@RobTF RobTF added the t/bug Something isn't working label May 4, 2023
@mattleibow mattleibow added platform/iOS 🍎 area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-controls-image Image control labels May 4, 2023
@mattleibow mattleibow added this to the Backlog milestone May 4, 2023
@ghost
Copy link

ghost commented May 4, 2023

We've added this issue to our backlog, and we will work to address it as time and resources allow. If you have any additional information or questions about this issue, please leave a comment. For additional info about issue management, please read our Triage Process.

@Ahmadpashaquarterpi
Copy link

Ahmadpashaquarterpi commented May 8, 2023

Hi @RobTF ,
Is there any workaround for this issue?
I used the following but I don't think its any good for app

`<Frame x:Name="ButtonContainer" Grid.Column="0" CornerRadius="0" Padding="0" Margin="0" BackgroundColor="Transparent" BorderColor="Transparent">
                <ImageButton
                    HeightRequest="{Binding Source={x:Reference ButtonContainer}, Path=Height}"
                    WidthRequest="{Binding Source={x:Reference ButtonContainer}, Path=Width}"
                    Source="{DynamicResource CreateIcon}" BackgroundColor="Transparent"
                    HorizontalOptions="Start" VerticalOptions="Center"
                    Command="{Binding NavigateToCreateNew}"/>
            </Frame>`

@XamlTest
Copy link
Collaborator

XamlTest commented Jul 6, 2023

Verified this on Visual Studio Enterprise 17.7.0 Preview 2.0. Repro on iOS 16.4 with below Project:
ImageGridIssue.zip

image
image

@XamlTest XamlTest added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed labels Jul 6, 2023
@jknaudt21
Copy link
Contributor

Possibly related to: #16120

@jknaudt21 jknaudt21 self-assigned this Sep 1, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Nov 22, 2023
@samhouts samhouts added the fixed-in-8.0.0-rc.2.9511 Look for this fix in 8.0.0-rc.2.9511 label Dec 19, 2023
@Eilon Eilon removed the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label May 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-image Image control area-layout StackLayout, GridLayout, ContentView, AbsoluteLayout, FlexLayout, ContentPresenter delighter fixed-in-8.0.0-rc.2.9511 Look for this fix in 8.0.0-rc.2.9511 platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants