diff --git a/src/Controls/src/Core/RadioButton/RadioButton.cs b/src/Controls/src/Core/RadioButton/RadioButton.cs index 6a83884c2984..db2bfec12c8b 100644 --- a/src/Controls/src/Core/RadioButton/RadioButton.cs +++ b/src/Controls/src/Core/RadioButton/RadioButton.cs @@ -643,8 +643,17 @@ public string ContentAsString() Font ITextStyle.Font => this.ToFont(); -#if ANDROID - object IContentView.Content => ContentAsString(); +#if ANDROID + object IContentView.Content + { + get + { + if (ResolveControlTemplate() == null) + return ContentAsString(); + + return Content; + } + } #endif IView IContentView.PresentedContent => ((this as IControlTemplated).TemplateRoot as IView) ?? (Content as IView); diff --git a/src/Controls/tests/TestCases.Android.Tests/snapshots/android/RadioButtonContentNotRendering.png b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/RadioButtonContentNotRendering.png new file mode 100644 index 000000000000..1073d4b72ced Binary files /dev/null and b/src/Controls/tests/TestCases.Android.Tests/snapshots/android/RadioButtonContentNotRendering.png differ diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25887.xaml b/src/Controls/tests/TestCases.HostApp/Issues/Issue25887.xaml new file mode 100644 index 000000000000..1dde4c7ffea1 --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25887.xaml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Controls/tests/TestCases.HostApp/Issues/Issue25887.xaml.cs b/src/Controls/tests/TestCases.HostApp/Issues/Issue25887.xaml.cs new file mode 100644 index 000000000000..0e2b6861ec9a --- /dev/null +++ b/src/Controls/tests/TestCases.HostApp/Issues/Issue25887.xaml.cs @@ -0,0 +1,10 @@ +namespace Maui.Controls.Sample.Issues; + +[Issue(IssueTracker.Github, 25887, "ContentPresenter just rendering component string in .Net9", PlatformAffected.Android)] +public partial class Issue25887 : ContentPage +{ + public Issue25887() + { + InitializeComponent(); + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25887.cs b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25887.cs new file mode 100644 index 000000000000..e203f9d45416 --- /dev/null +++ b/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue25887.cs @@ -0,0 +1,23 @@ +using NUnit.Framework; +using UITest.Appium; +using UITest.Core; + +namespace Microsoft.Maui.TestCases.Tests.Issues +{ + public class Issue25887 : _IssuesUITest + { + public Issue25887(TestDevice testDevice) : base(testDevice) + { + } + + public override string Issue => "ContentPresenter just rendering component string in .Net9"; + + [Test] + [Category(UITestCategories.RadioButton)] + public void RadioButtonContentNotRendering() + { + App.WaitForElement("RadioButtonTemplate1"); + VerifyScreenshot(); + } + } +} \ No newline at end of file diff --git a/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/RadioButtonContentNotRendering.png b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/RadioButtonContentNotRendering.png new file mode 100644 index 000000000000..69726e16d53f Binary files /dev/null and b/src/Controls/tests/TestCases.WinUI.Tests/snapshots/windows/RadioButtonContentNotRendering.png differ diff --git a/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/RadioButtonContentNotRendering.png b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/RadioButtonContentNotRendering.png new file mode 100644 index 000000000000..09f87b0a3b89 Binary files /dev/null and b/src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/RadioButtonContentNotRendering.png differ