-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Windows] Fixed Entry Editor placeholder Text CharacterSpacing #30324
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
base: main
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR enhances the Windows platform TextBox to apply CharacterSpacing to placeholder text and adds UI tests to verify the behavior.
- Update
UpdateCharacterSpacingto also apply spacing to the placeholder element once the control is loaded. - Introduce
ApplyCharacterSpacingToPlaceholderhelper method. - Add cross-platform UI tests and a sample host app page for Issue 30071.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/src/Platform/Windows/TextBoxExtensions.cs | Extend UpdateCharacterSpacing to handle placeholder; add ApplyCharacterSpacingToPlaceholder. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30071.cs | New NUnit UITest to confirm placeholder spacing before and after tapping the button. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue30071.cs | Sample page demonstrating Entry/Editor placeholder spacing change on Windows. |
Comments suppressed due to low confidence (1)
src/Core/src/Platform/Windows/TextBoxExtensions.cs:76
- Consider updating the public XML documentation and any docs in /docs/ to note that placeholder text on Windows now also respects CharacterSpacing.
public static void UpdateCharacterSpacing(this TextBox textBox, ITextStyle textStyle)
| static void ApplyCharacterSpacingToPlaceholder(this TextBox textBox, int characterSpacing) | ||
| { | ||
| var placeholderTextBlock = textBox.GetDescendantByName<TextBlock>("PlaceholderTextContentPresenter"); |
Copilot
AI
Jun 30, 2025
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.
[nitpick] Extract the literal "PlaceholderTextContentPresenter" into a constant to avoid magic strings and typos.
| static void ApplyCharacterSpacingToPlaceholder(this TextBox textBox, int characterSpacing) | |
| { | |
| var placeholderTextBlock = textBox.GetDescendantByName<TextBlock>("PlaceholderTextContentPresenter"); | |
| private const string PlaceholderTextContentPresenterName = "PlaceholderTextContentPresenter"; | |
| static void ApplyCharacterSpacingToPlaceholder(this TextBox textBox, int characterSpacing) | |
| { | |
| var placeholderTextBlock = textBox.GetDescendantByName<TextBlock>(PlaceholderTextContentPresenterName); |
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| public void Issue30071PlaceholderCharacterSpacingShouldApply() | ||
| { | ||
| App.WaitForElement("label"); | ||
| VerifyScreenshot(); |
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.
Pending snapshots. Running a build.
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.
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.
Related with this, could we update the Entry UITest Matrix to verify all the possibilities with the placeholder? TextColor, CharacterSpacing etc.
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.
@jsuarezruiz These scenarios, including placeholder properties such as TextColor and CharacterSpacing, are already covered in the Entry feature matrix tests.
|
/azp run MAUI-UITests-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |
| } | ||
| } | ||
|
|
||
| static void ApplyCharacterSpacingToPlaceholder(this TextBox textBox, int characterSpacing) |
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.
Should the characterSpacing be a double?
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.
@jsuarezruiz As mentioned here, the CharacterSpacing property of TextBlock is of type int, not double. If we use a double parameter, it needs to be cast before assigning the value to the property. To avoid this, I used an int parameter instead. Please let me know if you have any other concerns.

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!
Root Cause :
The UpdateCharacterSpacing method only applied character spacing to the main text content of the TextBox
Description of Change
Enhanced the UpdateCharacterSpacing method to apply character spacing to placeholder text also.
Issues Fixed
Fixes #30071
Tested the behaviour in the following platforms
Screenshot