Skip to content

Conversation

@SyedAbdulAzeemSF4852
Copy link
Contributor

Issue Details

  • The radio button's BorderColor and BorderWidth are not updated at runtime.

Root Cause

  • Handling of runtime changes for BorderColor and BorderWidth has not been implemented.

Description of Change

  • Implemented the OnPropertyChanged method to check if the changed property is either BorderColor or BorderWidth. If so, then updated the StrokeColor or StrokeThickness of the radio button in the handler accordingly.

Reference :

protected override void OnPropertyChanged([CallerMemberName] string propertyName = null)

Validated the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Issues Fixed

Fixes #15806

Output

Before Fix After Fix
RadioButtonBorderColorNotChanged.mp4
RadioButtonBorderColorChanged.mp4

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Mar 12, 2025
@jsuarezruiz jsuarezruiz added the area-controls-radiobutton RadioButton, RadioButtonGroup label Mar 12, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 changed the title [Windows] Fix for RadioButton BorderColor not working for Focused Visual State [Windows] Fix for RadioButton BorderColor and BorderWidth not updated at runtime. Mar 13, 2025
@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 changed the title [Windows] Fix for RadioButton BorderColor and BorderWidth not updated at runtime. [Windows] Fix for RadioButton BorderColor and BorderWidth not updated at runtime Mar 13, 2025
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 marked this pull request as ready for review March 14, 2025 10:38
@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 requested a review from a team as a code owner March 14, 2025 10:38
Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

Could you commit the pending snapshots?
image

@SyedAbdulAzeemSF4852
Copy link
Contributor Author

@jsuarezruiz , I have committed the pending snapshots.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

The default RadioButton border width is -1:

public static readonly BindableProperty BorderWidthProperty = BindableProperty.Create(nameof(IBorderElement.BorderWidth), typeof(double), typeof(IBorderElement), -1d);

In the sample, set the BorderColor (Normal state) to Red color but, not assign a value to BorderWidth.

The snapshot on any platform not render the border, as expected:

But on Windows:

Could you review it?

@SyedAbdulAzeemSF4852
Copy link
Contributor Author

@jsuarezruiz , Previously, on Windows, if the BorderWidth was not explicitly specified, it would default to a Thickness object with a value of 3. As a result, the border would appear visible on Windows even though no border width was set, which could lead to inconsistencies in the UI across different platforms. Later it was fixed in this PR.

In addition to setting the BorderColor, I have also included the BorderWidth in the test case to ensure consistent behavior across all platforms. This ensures that the border styling (both color and width) is applied uniformly, making the appearance of the RadioButton consistent regardless of the platform.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

I think there are some inconsistencies with how the RadioButton behaves across platforms. In the added sample, the normal and focused states use different colors—Red and DarkCyan, respectively.

  • On Android, borders are completely missing, making selection unclear.
  • The focus color is applied correctly on Windows, while other platforms do not display it properly.
  • Additionally, the RadioButton expands to the full width of its container on most platforms, but Windows does not follow this behavior.

Could you review it? can we align the behavior between platforms?

@SyedAbdulAzeemSF4852
Copy link
Contributor Author

@jsuarezruiz , The issue of RadioButton focus events not firing on iOS and Android has already been mentioned. Issue - 28163.
However, with my fix, the checked and unchecked states now behave consistently across all platforms by updating the border color and width accordingly.
Regarding the full-width behavior on Windows, this behavior is observed in native radio button also. I have attached a image for reference.
RadioButton

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-radiobutton RadioButton, RadioButtonGroup community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RadioButton Border color not working for focused visual state

3 participants