Skip to content

[Android] RadioButton border does not clear when BorderColor, BorderWidth, or CornerRadius are reset to default values - #37146

Merged
kubaflo merged 4 commits into
dotnet:inflight/currentfrom
HarishwaranVijayakumar:fix/android-radiobutton-border-reset
Aug 7, 2026
Merged

kubaflo merged 4 commits into
dotnet:inflight/currentfrom
HarishwaranVijayakumar:fix/android-radiobutton-border-reset

Conversation

@HarishwaranVijayakumar

Copy link
Copy Markdown
Contributor

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Issue Details:

  • On Android, after setting BorderColor , BorderWidth , or CornerRadius on a RadioButton to non-default values, resetting them back to their defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 ) does not clear the previously rendered border. The border remains visually unchanged.

Root Cause of the issue:

  • In the Android platform implementation, the  UpdateBorderDrawable  method in  RadioButtonExtensions  only updates the border drawable when the property values are non-default — it skips the update when  StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is zero. This means when a user resets these properties back to their defaults at runtime, the method never tells the drawable to clear its previously cached values, so the old border continues to render.

Description of Change

Bug fix: RadioButton border property handling on Android

  • Updated UpdateBorderDrawable in RadioButtonExtensions.cs to always set border color, width, and corner radius, even when reset to default values, ensuring the UI reflects property changes correctly.

Test coverage improvements

  • Added a new test case page Issue37145 in TestCases.HostApp that allows setting and clearing RadioButton border properties via UI buttons.
  • Introduced a UI test Issue37145 in TestCases.Shared.Tests that verifies the border is correctly cleared and reapplied when interacting with the test case page.

Issues Fixed

Fixes #37145

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Output

Before After
RadioButton-beforefix.mov
RadioButton-afterfix.mov

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37146

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37146"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Aug 6, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@HarishwaranVijayakumar! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@vishnumenon2684

Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@HarishwaranVijayakumar HarishwaranVijayakumar changed the title [WIP][Android] RadioButton border does not clear when BorderColor, BorderWidth, or CornerRadius are reset to default values [Android] RadioButton border does not clear when BorderColor, BorderWidth, or CornerRadius are reset to default values Aug 7, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review August 7, 2026 13:59
Copilot AI review requested due to automatic review settings August 7, 2026 13:59
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes an Android-specific visual state bug where a RadioButton’s border would remain rendered after resetting BorderColor, BorderWidth, or CornerRadius back to their default values at runtime. The fix ensures the Android BorderDrawable is explicitly updated with default values so it can clear previously cached stroke state, and adds a UI test page + screenshot-based UI test to prevent regressions.

Changes:

  • Android: Always apply border brush/width/corner radius updates in RadioButtonExtensions.UpdateBorderDrawable, including default (clearing) values.
  • Tests: Add a HostApp repro page (Issue37145) with buttons to set/clear border properties at runtime.
  • Tests: Add an Appium UI test (Issue37145) that verifies the border is cleared and can be re-applied (via screenshot baselines).

Reviewed changes

Copilot reviewed 3 out of 9 changed files in this pull request and generated no comments.

File Description
src/Core/src/Platform/Android/RadioButtonExtensions.cs Ensures border drawable state is updated even when properties reset to defaults, allowing proper clearing.
src/Controls/tests/TestCases.HostApp/Issues/Issue37145.cs Adds a manual repro page with UI controls to toggle border properties.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue37145.cs Adds screenshot-based UI coverage validating clear + reapply behavior.

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 7, 2026
@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Aug 7, 2026

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

AI Review Summary

@HarishwaranVijayakumar — new AI review results are available based on this last commit: 932cce1.

Gate Passed Confidence Unknown Platform Android


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ✅ PASSED

Platform: ANDROID · Base: main · Merge base: f27ca83a

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue37145 Issue37145 ✅ FAIL — 1514s ✅ PASS — 639s
🔴 Without fix — 🖥️ Issue37145: FAIL ✅ · 1514s

Error-relevant lines (filtered from the build log):

     at Microsoft.Maui.TestCases.Tests.Issues.Issue37145.VerifyRadioButtonBorderClearsWhenResetToDefaults() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue37145.cs:line 36
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
🟢 With fix — 🖥️ Issue37145: PASS ✅ · 639s

(no coded error found; showing last 1200 chars)

ution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.12]   Discovering: Controls.TestCases.Android.Tests
[xUnit.net 00:00:00.39]   Discovered:  Controls.TestCases.Android.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /home/vsts/work/1/s/artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/Controls.TestCases.Android.Tests.dll
   NUnit3TestExecutor discovered 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 08/07/2026 16:22:28 FixtureSetup for Issue37145(Android)
>>>>> 08/07/2026 16:22:30 VerifyRadioButtonBorderClearsWhenResetToDefaults Start
>>>>> 08/07/2026 16:22:37 VerifyRadioButtonBorderClearsWhenResetToDefaults Stop
  Passed VerifyRadioButtonBorderClearsWhenResetToDefaults [6 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue37145.trx
Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 23.2961 Seconds
>>> TRX_RESULT_FILE: /home/vsts/work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue37145.trx
📁 Fix files reverted (1 files)
  • src/Core/src/Platform/Android/RadioButtonExtensions.cs

📋 Pre-Flight — Context & Validation

PR #37146 Pre-Flight

Context

  • PR: [Android] RadioButton border does not clear when BorderColor, BorderWidth, or CornerRadius are reset to default values
  • Issue: #37145
  • Base / merge base: main / f27ca83a4765f6491530f42090672c03e632d14d
  • Materialized review commit: 0c74781c16
  • Platform: Android
  • Problem: After a RadioButton has a non-default border, resetting BorderColor to null, BorderWidth to 0, or CornerRadius to 0 leaves the previous value cached in the Android BorderDrawable.

Current PR Fix

The production change is limited to src/Core/src/Platform/Android/RadioButtonExtensions.cs. The existing implementation only calls the drawable setters for non-default values. The PR replaces those conditional updates with unconditional calls:

mauiDrawable.SetBorderBrush(new SolidPaint { Color = radioButton.StrokeColor });
mauiDrawable.SetBorderWidth(Math.Max(0, radioButton.StrokeThickness));
mauiDrawable.SetCornerRadius(Math.Max(0, radioButton.CornerRadius));

This clears cached drawable state while clamping negative width/radius values. The PR also adds the Issue37145 HostApp page, one screenshot UI test, and Android/iOS reference snapshots (9 files total, +99/-10).

Direct Diff Assessment

  • The baseline bug is in UpdateBorderDrawable: guards around StrokeColor, StrokeThickness, and CornerRadius suppress reset updates.
  • BorderDrawable exposes nullable SetBorderBrush, plus width and corner-radius setters that invalidate its cached drawing state.
  • Any alternative must differ from the PR's root strategy of unconditionally reapplying all three properties in UpdateBorderDrawable.
  • No public API change is involved.
  • The prior mechanical regression cross-reference reported no overlap with recent labeled bug-fix PRs.

Test Contract

The gate already proved the regression:

  • Without the production fix: Issue37145 failed.
  • With the production fix: Issue37145 passed.

Use only:

pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue37145"

No additional mandatory regression tests were supplied for STEP 5a. Do not rerun the gate and do not run a full suite.

Candidate Constraints

  • One implementation/test pass and at most one focused correction/retest per candidate.
  • Use EstablishBrokenBaseline.ps1 for baseline and restoration; never manually restore fix files.
  • Preserve unrelated dirty workflow/script changes already present in the worktree.
  • Perform the try-fix inline expert self-review; do not launch a separate reviewer.

🔬 Code Review — Deep Analysis

⚠️ Code Review did not produce output on this run.

The Copilot expert-review task ended before this phase was persisted, usually because the review-stage time budget expired or the CI agent encountered a transient authentication/runtime problem. Earlier completed sections remain valid, but this review is incomplete without this phase.

Next step: re-comment /review to retry on a fresh agent. If this repeats across runs, a maintainer should inspect the reviewer token and Task 3 logs.


🛠️ Fix — Analysis & Comparison

Try-Fix Aggregate - PR #37146

Candidate 1 - Rebuild the BorderDrawable

Model: claude-opus-5
Result: Pass
Test executions: 1 of 2 permitted
Self-review: 2 moderate findings; 0 critical/major

Approach

This candidate treats the defect as a drawable-lifetime problem rather than missing default-value setter calls. BorderDrawable is a long-lived, incrementally mutated cache with no atomic reset path. On every border update, the candidate detaches and disposes the existing drawable and constructs a pristine replacement. The original conditional setters remain unchanged; default values are represented by untouched fields in the new drawable.

This differs from the PR's unconditional in-place updates: it eliminates stale cached state instead of pushing null/zero values through every setter.

Diff

diff --git a/src/Core/src/Platform/Android/RadioButtonExtensions.cs b/src/Core/src/Platform/Android/RadioButtonExtensions.cs
index 30d7769a04..20b83769c2 100644
--- a/src/Core/src/Platform/Android/RadioButtonExtensions.cs
+++ b/src/Core/src/Platform/Android/RadioButtonExtensions.cs
@@ -47,15 +47,19 @@ namespace Microsoft.Maui.Platform
 
 		internal static void UpdateBorderDrawable(this AppCompatRadioButton platformView, IRadioButton radioButton)
 		{
-			BorderDrawable? mauiDrawable = platformView.Background as BorderDrawable;
-
-			if (mauiDrawable == null)
+			// BorderDrawable accumulates state across updates and has no reset path, so a drawable that
+			// already has a border can never go back to "no border". Rebuild it from the current values
+			// instead of mutating the stale one.
+			if (platformView.Background is BorderDrawable staleDrawable)
 			{
-				mauiDrawable = new BorderDrawable(platformView.Context);
-
-				platformView.Background = mauiDrawable;
+				platformView.Background = null;
+				staleDrawable.Dispose();
 			}
 
+			var mauiDrawable = new BorderDrawable(platformView.Context);
+
+			platformView.Background = mauiDrawable;
+
 			mauiDrawable.SetBackground(radioButton.Background);
 
 			if (radioButton.StrokeColor != null)

Test Result

pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue37145"

Passed on the first run. The initial, cleared, and reapplied border screenshots all matched. No correction or other test command was used.

Analysis

The approach is self-maintaining if more cached drawable fields are added and avoids clamping, but it allocates a new BorderDrawable for each mapper call and discards Android-side drawable state such as bounds/callback/level. Those two concrete risks were recorded as moderate self-review findings. The PR's in-place fix is more allocation-efficient.

Detailed narrative: CustomAgentLogsTmp/PRState/37146/PRAgent/try-fix-1/content.md
Attempt artifacts: CustomAgentLogsTmp/PRState/37146/PRAgent/try-fix/attempt-1/

Candidate 2 - Property-scoped drawable synchronization

Model: gpt-5.6-sol
Result: Pass
Test executions: 1 of 2 permitted
Self-review: Clean; 0 findings

Approach

This candidate treats reuse of the aggregate initializer for independent property mapper callbacks as the defect. It creates and fully initializes BorderDrawable once, then updates only the property owned by each mapper. Null/zero deltas therefore clear the corresponding cached field without rewriting unrelated state or replacing the drawable. An internal color overload shares the existing solid-brush state transition without allocating a temporary SolidPaint.

This differs from both prior strategies: the PR broadly rewrites all fields on every callback, while candidate 1 replaces the drawable on every callback. Candidate 2 preserves the instance and applies property-scoped deltas after one complete bootstrap.

Diff

diff --git a/src/Core/src/Platform/Android/BorderDrawable.cs b/src/Core/src/Platform/Android/BorderDrawable.cs
index 9463b502e6..a760782875 100644
--- a/src/Core/src/Platform/Android/BorderDrawable.cs
+++ b/src/Core/src/Platform/Android/BorderDrawable.cs
@@ -180,13 +180,18 @@ namespace Microsoft.Maui.Platform
 		}
 
 		public void SetBorderBrush(SolidPaint solidPaint)
+		{
+			SetBorderBrush(solidPaint.Color);
+		}
+
+		internal void SetBorderBrush(Microsoft.Maui.Graphics.Color? color)
 		{
 			_invalidatePath = true;
 			_borderColor = null;
 
-			var borderColor = solidPaint.Color == null
+			var borderColor = color == null
 				? (AColor?)null
-				: solidPaint.Color.ToPlatform();
+				: color.ToPlatform();
 
 			_stroke = null;
 			SetBorderColor(borderColor);
diff --git a/src/Core/src/Platform/Android/RadioButtonExtensions.cs b/src/Core/src/Platform/Android/RadioButtonExtensions.cs
index 30d7769a04..aa7c944b31 100644
--- a/src/Core/src/Platform/Android/RadioButtonExtensions.cs
+++ b/src/Core/src/Platform/Android/RadioButtonExtensions.cs
@@ -17,7 +17,10 @@ namespace Microsoft.Maui.Platform
 				return;
 			}
 
-			platformRadioButton.UpdateBorderDrawable(radioButton);
+			var mauiDrawable = platformRadioButton.GetOrCreateBorderDrawable(radioButton, out bool created);
+
+			if (!created)
+				mauiDrawable.SetBackground(radioButton.Background);
 		}
@@ -32,40 +35,46 @@ namespace Microsoft.Maui.Platform
 		public static void UpdateStrokeColor(this AppCompatRadioButton platformRadioButton, IRadioButton radioButton)
 		{
-			platformRadioButton.UpdateBorderDrawable(radioButton);
+			var mauiDrawable = platformRadioButton.GetOrCreateBorderDrawable(radioButton, out bool created);
+			if (!created)
+				mauiDrawable.SetBorderBrush(radioButton.StrokeColor);
 		}
 
 		public static void UpdateStrokeThickness(this AppCompatRadioButton platformRadioButton, IRadioButton radioButton)
 		{
-			platformRadioButton.UpdateBorderDrawable(radioButton);
+			var mauiDrawable = platformRadioButton.GetOrCreateBorderDrawable(radioButton, out bool created);
+			if (!created)
+				mauiDrawable.SetBorderWidth(radioButton.StrokeThickness > 0 ? radioButton.StrokeThickness : 0);
 		}
 
 		public static void UpdateCornerRadius(this AppCompatRadioButton platformRadioButton, IRadioButton radioButton)
 		{
-			platformRadioButton.UpdateBorderDrawable(radioButton);
+			var mauiDrawable = platformRadioButton.GetOrCreateBorderDrawable(radioButton, out bool created);
+			if (!created)
+				mauiDrawable.SetCornerRadius(radioButton.CornerRadius > 0 ? radioButton.CornerRadius : 0);
 		}
 
-		internal static void UpdateBorderDrawable(this AppCompatRadioButton platformView, IRadioButton radioButton)
+		static BorderDrawable GetOrCreateBorderDrawable(this AppCompatRadioButton platformView, IRadioButton radioButton, out bool created)
 		{
-			BorderDrawable? mauiDrawable = platformView.Background as BorderDrawable;
-
-			if (mauiDrawable == null)
+			if (platformView.Background is BorderDrawable mauiDrawable)
 			{
-				mauiDrawable = new BorderDrawable(platformView.Context);
-
-				platformView.Background = mauiDrawable;
+				created = false;
+				return mauiDrawable;
 			}
 
+			created = true;
+			mauiDrawable = new BorderDrawable(platformView.Context);
+			platformView.Background = mauiDrawable;
 			mauiDrawable.SetBackground(radioButton.Background);
-
-			if (radioButton.StrokeColor != null)
-				mauiDrawable.SetBorderBrush(new SolidPaint { Color = radioButton.StrokeColor });
-
-			if (radioButton.StrokeThickness > 0)
-				mauiDrawable.SetBorderWidth(radioButton.StrokeThickness);
-
-			if (radioButton.CornerRadius > 0)
-				mauiDrawable.SetCornerRadius(radioButton.CornerRadius);
+			mauiDrawable.SetBorderBrush(radioButton.StrokeColor);
+			mauiDrawable.SetBorderWidth(radioButton.StrokeThickness > 0 ? radioButton.StrokeThickness : 0);
+			mauiDrawable.SetCornerRadius(radioButton.CornerRadius > 0 ? radioButton.CornerRadius : 0);
+			return mauiDrawable;
 		}

Test Result

pwsh .github/scripts/BuildAndRunHostApp.ps1 -Platform android -TestFilter "Issue37145"

Passed on the first run. The Android HostApp built and deployed, and the set, clear-to-default, and reapply states passed. No correction or other test command was used.

Analysis

One-time full initialization handles mapper ordering when the drawable is absent; subsequent callbacks are idempotent and allocation-free for their own property. The drawable instance and Android-side state remain intact. Inline expert self-review found no issues in the final diff.

Detailed narrative: CustomAgentLogsTmp/PRState/37146/PRAgent/try-fix-2/content.md
Attempt artifacts: CustomAgentLogsTmp/PRState/37146/PRAgent/try-fix/attempt-2/


📝 Recommended PR Title & Description

Assessment: ✏️ Recommend updating — the current description says the drawable is updated in place, but the winning fix instead replaces stale BorderDrawable instances and therefore needs materially different implementation details.

Recommended title

[Android] RadioButton: Clear border when BorderColor, BorderWidth, or CornerRadius reset to defaults

Recommended description

### Issue Details

- On Android, after setting `BorderColor`, `BorderWidth`, or `CornerRadius` on a `RadioButton` to non-default values, resetting them to their defaults (`BorderColor = null`, `BorderWidth = 0`, or `CornerRadius = 0`) leaves the previously rendered border visible.

### Root Cause of the Issue

- `RadioButtonExtensions.UpdateBorderDrawable` incrementally mutates a long-lived Android `BorderDrawable`.
- The existing implementation only forwards non-default values, so resetting a property never clears the corresponding cached drawable state.

### Description of Change

**Bug fix: rebuild the Android RadioButton border drawable from current state**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to detach and dispose an existing `BorderDrawable` before creating a pristine replacement.
- The replacement is initialized from the current `RadioButton` background and non-default border values, so reset properties remain at their drawable defaults instead of retaining stale cached values.
- The drawable is detached before disposal, matching the existing Android background-cleanup sequence.

**Test coverage improvements**
- Added the `Issue37145` page in `TestCases.HostApp` with controls for clearing and reapplying `RadioButton` border properties.
- Added the `Issue37145` UI test in `TestCases.Shared.Tests` to verify the initial border, the cleared state, and reapplication.
- Added Android and iOS reference snapshots.

### Issues Fixed

Fixes #37145

### Tested the behavior in the following platforms

- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output

| Before | After |
|---|---|
| <video src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893"> | <video src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7"> |

🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Winner: try-fix-1

try-fix-1 is the strongest available candidate because it passed the required Android regression test and its fresh-drawable strategy covers the expert review's color-only reset state transition. The raw PR and try-fix-2 retain that correctness gap. The one permitted pr-plus-reviewer refinement introduced a visible test control without new snapshots, so its full-screen screenshot assertions would regress; the hard contract prohibits repairing or retesting it.

Candidate comparison

Rank Candidate Regression evidence Assessment
1 try-fix-1 Passed Issue37145 on Android. Detaches and disposes the stale BorderDrawable, then builds a pristine drawable from current values. Assigning the replacement background guarantees a redraw for color-only resets. It has moderate allocation and drawable-state tradeoffs, and it inherits the PR's Windows/Mac Catalyst screenshot-baseline gap, but it is the only production-complete candidate with valid targeted evidence.
2 pr Trusted Gate passed: failure without the fix and success with it. The localized unconditional-setter strategy is preferable in principle, but SetBorderBrush(SolidPaint) clears _borderColor before SetBorderColor(null). The equality guard can therefore suppress the only invalidation when BorderColor alone is reset. The test clears all properties together and masks this path; it also lacks Windows/Mac Catalyst baselines or a guard.
3 try-fix-2 Passed Issue37145 on Android. Property-scoped updates preserve drawable identity and avoid repeat allocation, but the new SetBorderBrush(Color?) keeps the same pre-clear/equality-guard sequence. A color-only reset still has no guaranteed invalidation. Its passing test clears width/radius in the same action, supplying an incidental redraw, and it inherits the cross-platform snapshot gap.
4 pr-plus-reviewer Unverified and statically regression-prone. The sole command ran against the raw PR rather than the isolated worktree and was not repeated. Its production InvalidateSelf() and platform guard address both blocking findings, but adding a third visible button changes every uncropped full-page screenshot while reusing the original baselines. This candidate would need another patch and test run, both forbidden by the execution contract, so it ranks below candidates with valid passing evidence.

No candidate with a failed or invalid regression result is ranked above a candidate with a passing result.

Why try-fix-1 wins

  1. A replacement BorderDrawable begins with no cached color, width, radius, stroke, path, or paint state, so default values do not need to pass through equality-guarded setters.
  2. Reassigning platformView.Background makes the new drawable observable immediately, including the exact BorderColor: color -> null transition missed by the raw PR and try-fix-2.
  3. The candidate passed the required Android Issue37145 command on its first and only run.
  4. Its known costs are moderate rather than correctness-blocking: extra drawable/path allocations on mapper calls and loss of incidental Android drawable instance state.

Remaining concern

The shared screenshot test still needs either Windows and Mac Catalyst baselines or the established TEST_FAILS_ON_CATALYST && TEST_FAILS_ON_WINDOWS platform guard. That gap affects the raw PR and both STEP 5a candidates because they retain the submitted tests unchanged.

Because a try-fix-* candidate wins and the submitted PR still needs different production code (plus the screenshot-platform correction), the recommendation is REQUEST CHANGES.


📱 UI Tests — RadioButton,ViewBaseTests

Detected UI test categories: RadioButton,ViewBaseTests

✅ Deep UI tests — 149 passed, 0 failed across 2 categories on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
RadioButton 31/31 ✓ —
ViewBaseTests 118/119 ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

🧭 Next Steps — alternative fix proposed (try-fix-1)

Automated review — alternative fix proposed

The expert-reviewer evaluation compared the PR fix against automatically generated candidates and selected try-fix-1 as the strongest fix.

Why: try-fix-1 passed the required Android regression test and replaces stale drawable state atomically, covering the color-only reset path that remains broken in the raw PR and try-fix-2. Its allocation and drawable-lifetime costs are moderate, while pr-plus-reviewer cannot be selected because its visible test control invalidates the existing full-screen snapshots and its candidate validation was not actually exercised.

Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.

Candidate diff (try-fix-1)
diff --git a/src/Core/src/Platform/Android/RadioButtonExtensions.cs b/src/Core/src/Platform/Android/RadioButtonExtensions.cs
index 30d7769a04..20b83769c2 100644
--- a/src/Core/src/Platform/Android/RadioButtonExtensions.cs
+++ b/src/Core/src/Platform/Android/RadioButtonExtensions.cs
@@ -47,15 +47,19 @@ namespace Microsoft.Maui.Platform
 
 		internal static void UpdateBorderDrawable(this AppCompatRadioButton platformView, IRadioButton radioButton)
 		{
-			BorderDrawable? mauiDrawable = platformView.Background as BorderDrawable;
-
-			if (mauiDrawable == null)
+			// BorderDrawable accumulates state across updates and has no reset path, so a drawable that
+			// already has a border can never go back to "no border". Rebuild it from the current values
+			// instead of mutating the stale one.
+			if (platformView.Background is BorderDrawable staleDrawable)
 			{
-				mauiDrawable = new BorderDrawable(platformView.Context);
-
-				platformView.Background = mauiDrawable;
+				platformView.Background = null;
+				staleDrawable.Dispose();
 			}
 
+			var mauiDrawable = new BorderDrawable(platformView.Context);
+
+			platformView.Background = mauiDrawable;
+
 			mauiDrawable.SetBackground(radioButton.Background);
 
 			if (radioButton.StrokeColor != null)

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Aug 7, 2026
@kubaflo
kubaflo changed the base branch from main to inflight/current August 7, 2026 21:50
@kubaflo
kubaflo merged commit 8da57d7 into dotnet:inflight/current Aug 7, 2026
123 of 162 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR10 milestone Aug 7, 2026
kubaflo pushed a commit that referenced this pull request Aug 12, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
@sheiksyedm sheiksyedm modified the milestones: .NET 10 SR10, .NET 10 SR11 Aug 26, 2026
kubaflo pushed a commit that referenced this pull request Aug 27, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 2, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 3, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 3, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 4, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 6, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 7, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 7, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 8, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 8, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 9, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Sep 9, 2026
…idth, or CornerRadius are reset to default values (#37146)

<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!
<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Issue Details:

- On Android, after setting BorderColor , BorderWidth , or CornerRadius
on a RadioButton to non-default values, resetting them back to their
defaults ( BorderColor = null , BorderWidth = 0 , CornerRadius = 0 )
does not clear the previously rendered border. The border remains
visually unchanged.

### Root Cause of the issue:

- In the Android platform implementation, the  UpdateBorderDrawable 
method in  RadioButtonExtensions  only updates the border drawable when
the property values are non-default — it skips the update when
 StrokeColor  is null,  StrokeThickness  is zero, or  CornerRadius  is
zero. This means when a user resets these properties back to their
defaults at runtime, the method never tells the drawable to clear its
previously cached values, so the old border continues to render.


### Description of Change

**Bug fix: RadioButton border property handling on Android**
- Updated `UpdateBorderDrawable` in `RadioButtonExtensions.cs` to always
set border color, width, and corner radius, even when reset to default
values, ensuring the UI reflects property changes correctly.

**Test coverage improvements**
- Added a new test case page `Issue37145` in `TestCases.HostApp` that
allows setting and clearing `RadioButton` border properties via UI
buttons.
- Introduced a UI test `Issue37145` in `TestCases.Shared.Tests` that
verifies the border is correctly cleared and reapplied when interacting
with the test case page.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #37145 

### Tested the behavior in the following platforms
 
- [ ] Windows
- [x] Android
- [ ] iOS
- [ ] Mac

### Output
 
| Before | After |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/75bbc96c-65dd-464c-bce5-28a770a52893">
| <video
src="https://github.com/user-attachments/assets/e68016a5-1b09-4afa-8c2d-4489baa482d7">
|



<!--

Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 25, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] RadioButton border does not clear when BorderColor, BorderWidth, or CornerRadius are reset to default values

6 participants