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

Problems with Button and ImageButton #5347

Closed
david-maw opened this issue Mar 16, 2022 · 6 comments · Fixed by #5610
Closed

Problems with Button and ImageButton #5347

david-maw opened this issue Mar 16, 2022 · 6 comments · Fixed by #5610
Assignees
Labels
area-controls-button Button, ImageButton fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! platform/android 🤖 s/needs-attention Issue has more information and needs another look s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage t/bug Something isn't working
Milestone

Comments

@david-maw
Copy link

Description

There are a variety of issues on Android (maybe other places too, but that's all I've tried).

The issues I've noticed are:

  1. A Button has a Shadow that cannot be eliminated (an ImageButton does not)
  2. CornerRadius is ignored (at least sometimes, I've seen it work when set from code),

I suspect there I've seen other issues in more complex circumstances, but these are the obvious simple ones.
MAUIButtons.zip
MauiButtons

Steps to Reproduce

Test program and snapshots of the pages it produces attached

Version with bug

Preview 13 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

Unknown, I tested only on Android 11

Did you find any workaround?

No response

Relevant log output

No response

@david-maw david-maw added s/needs-verification Indicates that this issue needs initial verification before further triage will happen t/bug Something isn't working labels Mar 16, 2022
@XamlTest XamlTest added s/triaged Issue has been reviewed s/verified Verified / Reproducible Issue ready for Engineering Triage labels Mar 17, 2022
@XamlTest
Copy link

Verified on Visual Studio Enterprise 2022 main 17.2.0 Preview 2.0 [32223.438.main]. Repro on Android with above project.

@J-Swift
Copy link
Contributor

J-Swift commented Mar 17, 2022

CornerRadius should be handled by this #4820. You can workaround it by converting to PX from DP when setting on Android.

You can "workaround" the shadow using this #2918 (comment). It loses some tapped state functionality though.

@jfversluis jfversluis added platform/android 🤖 area-controls-button Button, ImageButton and removed s/needs-verification Indicates that this issue needs initial verification before further triage will happen labels Mar 17, 2022
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Mar 17, 2022
@jsuarezruiz
Copy link
Contributor

Could you try again with Preview 14?. This should be fixed by #4820

@david-maw
Copy link
Author

david-maw commented Mar 17, 2022

Done, it's better, the shadow issues on Android seem to be fixed, but to follow up on my suspicions about CornerRadious I added this to Button_Clicked:

if (sender is Button btn)
{
    if (btn.CornerRadius == 0)
    {
        btn.CornerRadius = 20;
        btn.BackgroundColor = Colors.PaleVioletRed;
    }
    else
    {
        btn.CornerRadius = 0;
        btn.BackgroundColor = Colors.PaleGreen;
    }
}
else if (sender is ImageButton ibtn)
{
    if (ibtn.CornerRadius == 0)
    {
        ibtn.CornerRadius = 20;
        ibtn.BackgroundColor = Colors.PaleVioletRed;
    }
    else
    {
        ibtn.CornerRadius = 0;
        ibtn.BackgroundColor = Colors.PaleGreen;
    }
}

As I suspected, it's not quite right, on Android it looks like the ImageButton CornerRadius is still being interpreted as PX not DP, the Button handling of the same property seems ok.

On Windows dynamically setting CornerRadius does not seem to do anything either on Button or ImageButton.

@Redth Redth added the s/needs-attention Issue has more information and needs another look label Mar 21, 2022
@Redth Redth added this to the 6.0.300-rc.2 milestone Mar 21, 2022
@J-Swift
Copy link
Contributor

J-Swift commented Mar 22, 2022

@jsuarezruiz / @Redth it looks like #4820 actually got orphaned on the release/6.0.2xx-preview13 branch, never being merged into p14.

@david-maw
Copy link
Author

Seems like it's fixed in RC1, thanks

@ghost ghost locked as resolved and limited conversation to collaborators May 13, 2022
@samhouts samhouts added the fixed-in-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! label Feb 17, 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-6.0.300-rc.1 Look for this fix in 6.0.300-rc.1! platform/android 🤖 s/needs-attention Issue has more information and needs another look 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