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

[Android] Fix RadioButton using ContentPresenter not rendering #25947

Merged
merged 6 commits into from
Nov 21, 2024
Merged

Conversation

jsuarezruiz
Copy link
Contributor

@jsuarezruiz jsuarezruiz commented Nov 19, 2024

Description of Change

Fix RadioButton using ContentPresenter not rendering on Android. Found the cause of the problem. The binding from ContentPresenter changed here 4c3a09c#diff-f01d408e1d2b3cd4a4c1bcf731586c215c9d57d4585d6815d5c89118a1ef3f44R20 (changes to allow trimming).

This PR apply changes to implement IContentView.Content in the RadioButton class.

Issues Fixed

Fixes #25887
The changes here, will also fix #24949

@jsuarezruiz jsuarezruiz added t/bug Something isn't working area-xaml XAML, CSS, Triggers, Behaviors platform/android 🤖 area-controls-radiobutton RadioButton, RadioButtonGroup labels Nov 19, 2024
@@ -9,7 +9,7 @@
namespace Microsoft.Maui.Controls
{
/// <include file="../../docs/Microsoft.Maui.Controls/RadioButton.xml" path="Type[@FullName='Microsoft.Maui.Controls.RadioButton']/Docs/*" />
public partial class RadioButton : TemplatedView, IElementConfiguration<RadioButton>, ITextElement, IFontElement, IBorderElement, IRadioButton
public partial class RadioButton : TemplatedView, IElementConfiguration<RadioButton>, IContentView, ITextElement, IFontElement, IBorderElement, IRadioButton
Copy link
Contributor Author

@jsuarezruiz jsuarezruiz Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get the RadioButton working with the compiled binding in ContentPresenter, needs to implement IContentView.Content.

To get ContentPresenter correctly working in all the cases, we must apply the same changes to:

  • TitleBar
  • IndicatorView

Classes from Controls that inherit from TemplatedView.

Waiting for feedback to proceed and also include tests related to those classes, or just keep what is related to RadioButton here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alternative c6c2cee
Just revert the binding change in the ContentPresenter, but this change was necessary to make MAUI trimmable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've modified the PR slightly

I think it's still relevant even with the alternative changes.

With Simons changes RB will still fall through to the unsafe path, so we need it to still react correctly and not go the unsafe path with warnings.

@PureWeen PureWeen marked this pull request as ready for review November 19, 2024 19:23
@PureWeen PureWeen requested a review from a team as a code owner November 19, 2024 19:23
mattleibow

This comment was marked as off-topic.

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think @mattleibow is on to something here.

It does feel like this should work
#24949 (comment)

I tested locally real quick and it didn't work, but, there might just be something simple that needs to be added/fixed

@PureWeen PureWeen merged commit 59ce48d into main Nov 21, 2024
106 checks passed
@PureWeen PureWeen deleted the fix-25887 branch November 21, 2024 17:21
@PureWeen
Copy link
Member

/backport to release/9.0.1xx

Copy link
Contributor

Started backporting to release/9.0.1xx: https://github.com/dotnet/maui/actions/runs/11958376858

@samhouts samhouts added the fixed-in-net8.0-nightly This may be available in a nightly release! label Dec 16, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-controls-radiobutton RadioButton, RadioButtonGroup area-xaml XAML, CSS, Triggers, Behaviors fixed-in-9.0.21 fixed-in-net8.0-nightly This may be available in a nightly release! platform/android 🤖 t/bug Something isn't working
Projects
Status: Done
5 participants