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

Button with Image on iOS and MacOS always missalign #8528

Closed
arkadym opened this issue Jul 5, 2022 · 6 comments · Fixed by #10309
Closed

Button with Image on iOS and MacOS always missalign #8528

arkadym opened this issue Jul 5, 2022 · 6 comments · Fixed by #10309
Labels
area-controls-button Button, ImageButton fixed-in-7.0.0-rc.2.6866 Look for this fix in 7.0.0-rc.2.6866! platform/iOS 🍎 s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working

Comments

@arkadym
Copy link

arkadym commented Jul 5, 2022

Description

Not possible to use Image with Button control it always missalign (see screenshots). Image always align to edge w/o any padding.
Using padding will not help because there always extra space in between image and text

Screenshot 2022-07-05 at 12 13 15
Screenshot 2022-07-05 at 12 13 07
Screenshot 2022-07-05 at 12 12 50
Screenshot 2022-07-05 at 12 15 20

Steps to Reproduce

  1. Create NET MAUI App
  2. Add any image to Click Me button (have to run on iOS or MacOS))
  3. Run app

Version with bug

6.0.400 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS, macOS

Affected platform versions

iOS 15, MacOS 12.3

Did you find any workaround?

No workaround found yet

Relevant log output

No response

@arkadym arkadym added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Jul 5, 2022
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Jul 5, 2022
@jsuarezruiz
Copy link
Contributor

The space between the icon and the text is larger than it was in Xamarin.Forms.
Issue8528.zip
Captura de Pantalla 2022-07-05 a las 10 45 20

@jsuarezruiz jsuarezruiz added s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Jul 5, 2022
@davidortinau
Copy link
Contributor

Yes, I'm seeing this also on Catalyst. No matter how wide I make the button or what padding is set, the image is at the edge.

@davidortinau
Copy link
Contributor

My workaround is to compose an Image and a Label

<Border Stroke="{StaticResource SecondaryBrush}" StrokeShape="{RoundRectangle CornerRadius=8}"
                                StrokeThickness="1" Background="Transparent"
                                Grid.Row="0" HorizontalOptions="End" VerticalOptions="Start"
                                SemanticProperties.Description="Button that opens a filter dialog"
                                >
                            <HorizontalStackLayout Margin="14,12" Spacing="12">
                                <Image Source="filter.png" VerticalOptions="Center" />
                                <Label Text="Filter" VerticalOptions="Center"/>
                            </HorizontalStackLayout>

                            <Border.GestureRecognizers>
                                <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
                            </Border.GestureRecognizers>
                        </Border>

So instead of this:

Screen Shot 2022-07-20 at 4 34 06 PM

I get this:

Screen Shot 2022-07-20 at 4 37 34 PM

@arkadym
Copy link
Author

arkadym commented Jul 21, 2022

Yes, is good idea, but i prefer keep it original, e.g. button has hover effect, click effect. So I've got another workaround - i realized negative padding works fine for image location:

ContentLayout="{OnPlatform Default='Top,2', iOS='Top,-10', MacCatalyst='Top,-10'}"
Padding="{OnPlatform Default='0,3', iOS='0,15,0,0', MacCatalyst='0,15,0,0'}" 

@AbstractionsAs
Copy link

Is there any progress on this?

@hartez
Copy link
Contributor

hartez commented Jan 27, 2023

This should have been closed when #10309 was merged.

@hartez hartez closed this as completed Jan 27, 2023
@samhouts samhouts added the fixed-in-7.0.0-rc.2.6866 Look for this fix in 7.0.0-rc.2.6866! label Feb 17, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Mar 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-button Button, ImageButton fixed-in-7.0.0-rc.2.6866 Look for this fix in 7.0.0-rc.2.6866! 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.

7 participants