Skip to content

Conversation

Nuklon
Copy link

@Nuklon Nuklon commented Aug 5, 2025

Pull request type

Please check the type of change your PR introduces:

  • Update
  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes

What is the current behavior?

If you use a PasswordBox, and specify a default password (Password="Test" for example), or bind it to an existing password, the placeholder doesn't get removed and the clear button isn't updated.

image

What is the new behavior?

image

As one would expect.

@Nuklon Nuklon requested a review from pomianowski as a code owner August 5, 2025 12:04
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. PR Pull request dotnet release labels Aug 5, 2025
@@ -123,12 +123,12 @@ public event RoutedEventHandler PasswordChanged
protected override void OnTextChanged(TextChangedEventArgs e)
{
UpdateTextContents(isTriggeredByTextInput: true);
SetPlaceholderTextVisibility();
Copy link
Author

Choose a reason for hiding this comment

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

This should always be called to ensure the placeholder/clear button is in sync with the text.

@Nuklon Nuklon changed the title Fix PasswordBox not updating placeholder and clear button when initialized Fix PasswordBox various issues Aug 5, 2025
@github-actions github-actions bot added the styles Topic is related to styles label Aug 5, 2025
@Nuklon
Copy link
Author

Nuklon commented Aug 5, 2025

2nd commit centers the buttons vertically, same as TextBox, so they look largely identical again.

Comment on lines -34 to -36
<Thickness x:Key="PasswordBoxLeftIconMargin">10,8,0,0</Thickness>
<Thickness x:Key="PasswordBoxRightIconMargin">0,8,10,0</Thickness>
<Thickness x:Key="PasswordBoxButtonMargin">0,5,4,0</Thickness>
Copy link
Author

Choose a reason for hiding this comment

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

Identical to TextBox now (copied from there).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
controls Changes to the appearance or logic of custom controls. dotnet PR Pull request release styles Topic is related to styles
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant