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

[iOS] RadioButton throws CGContextSetLineWidth - Fix #25542

Merged
merged 2 commits into from
Nov 9, 2024

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Oct 26, 2024

Description of Change

The error occurred because the default value for Border.StrokeThickness was set to -1. Instead of changing this default to 0, I implemented a converter that ensures Border.StrokeThickness never receives negative values.

Issues Fixed

Fixes #25273

Before
Screenshot 2024-10-26 at 15 19 01

@kubaflo kubaflo requested a review from a team as a code owner October 26, 2024 18:04
@kubaflo kubaflo requested review from Eilon and tj-devel709 October 26, 2024 18:04
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Oct 26, 2024
@kubaflo kubaflo added area-controls-radiobutton RadioButton, RadioButtonGroup platform/iOS 🍎 labels Oct 26, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo kubaflo requested a review from jsuarezruiz October 28, 2024 11:37
@jsuarezruiz
Copy link
Contributor

/azp run

jsuarezruiz
jsuarezruiz previously approved these changes Oct 31, 2024
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

border.SetBinding(Border.StrokeThicknessProperty, static (RadioButton rb) => rb.BorderWidth, source: RelativeBindingSource.TemplatedParent);

// NonNegativeValueConverter ensures that StrokeThickness remains non-negative as the default value of -1 triggers a CGContextSetLineWidth error on iOS.
border.SetBinding(Border.StrokeThicknessProperty, static (RadioButton rb) => rb.BorderWidth, source: RelativeBindingSource.TemplatedParent, converter: new NonNegativeValueConverter());
Copy link
Member

Choose a reason for hiding this comment

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

Can this be fixed inside the Border control?

So the border control could also check if this value is getting set to -1?
This fix feels isolated to only fixes RB's use of Border vs border as a larger use case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@PureWeen
Copy link
Member

PureWeen commented Nov 3, 2024

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen merged commit 50adaed into dotnet:main Nov 9, 2024
108 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RadioButtonGroup/RadioButton throw CGContextSetLineWidth error on iOS 18.0/18.1.
4 participants