Skip to content

Conversation

@SubhikshaSf4851
Copy link
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!

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

  • Windows
  • Android
  • iOS
  • Mac

Screenshot

Before Issue Fix After Issue Fix

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Jun 30, 2025
@SubhikshaSf4851 SubhikshaSf4851 marked this pull request as ready for review June 30, 2025 12:19
Copilot AI review requested due to automatic review settings June 30, 2025 12:19
@SubhikshaSf4851 SubhikshaSf4851 requested a review from a team as a code owner June 30, 2025 12:19
Copy link
Contributor

Copilot AI left a 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 UpdateCharacterSpacing to also apply spacing to the placeholder element once the control is loaded.
  • Introduce ApplyCharacterSpacingToPlaceholder helper 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)

Comment on lines +91 to +93
static void ApplyCharacterSpacingToPlaceholder(this TextBox textBox, int characterSpacing)
{
var placeholderTextBlock = textBox.GetDescendantByName<TextBlock>("PlaceholderTextContentPresenter");
Copy link

Copilot AI Jun 30, 2025

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.

Suggested change
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);

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

public void Issue30071PlaceholderCharacterSpacingShouldApply()
{
App.WaitForElement("label");
VerifyScreenshot();
Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

image Snapshots already available in the latest build. Could you commit the images?

Copy link
Contributor

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.

Copy link
Contributor Author

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.

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

}
}

static void ApplyCharacterSpacingToPlaceholder(this TextBox textBox, int characterSpacing)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

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

Labels

area-controls-editor Editor 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.

[Windows] CharacterSpacing not applied to Placeholder text in Entry and Editor controls

2 participants