-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Windows] Fix for the issue with Label text color when resetting from FormattedText. #25119
Conversation
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
35f319d
to
d67fd90
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
/rebase |
d67fd90
to
74b3759
Compare
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
src/Controls/src/Core/Label/Label.cs
Outdated
@@ -55,7 +55,9 @@ public partial class Label : View, IFontElement, ITextElement, ITextAlignmentEle | |||
{ | |||
var formattedString = ((FormattedString)oldvalue); | |||
var label = ((Label)bindable); | |||
|
|||
#if WINDOWS | |||
(label.Handler as LabelHandler)?.PlatformView?.TextHighlighters?.Clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be moved to here?
Platform.TextBlockExtensions.UpdateText(handler.PlatformView, label); |
Or into the extention method being called?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the fix into the TextBlockExtensions and ensured that the issue is resolved. Please review it and share if you have any concerns.
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
Root Cause of the issue
When changing the label text to FormattedText with text color, and then switching back to normal text, the text retains the formatted text color. This is due to the TextHighlighter applied in the UpdateInlines method of FormattedStringExtensions, which is not cleared when reverting to normal text.
Description of Change
I cleared the TextHighlighters in the UpdateText method of the TextBlockExtensions class before setting the normal text, which resolves the issue and works fine.
Issues Fixed
Fixes #24516
Tested the behaviour in the following platforms
Screenshot
FormattedTextIssue.mp4
FormattedTextColorFixed.mp4