Skip to content

Delete button in Win 11 themed TextBox #10180

Closed

Description

@fraluderin

I'm starting using new Win 11 theming for my new WPF projects.
I noticed that a "delete button" was added by default in the TextBox control:

Image

Is there a simple way to remove that button, e.g. with a property DisplayDeleteButton? I think this should be customizable to allow easy usage in scenarios that don't require a delete button.

If this has not been implemented yet, I'm available to contribute (but I'd need to be pointed in the right direction).

Activity

  1. himgoyalmicro commented on Dec 16, 2024

    @himgoyalmicro
    Contributor

    @fraluderin right now the only way to remove the delete button is to override the template. But your suggestion looks fine we can introduce a property that will control the visibility of the delete button.
    You can raise an API proposal for the same. After review we can proceed with the implementation.

  2. added
    API suggestion
    and removed on Dec 16, 2024
  3. dipeshmsft commented on Dec 18, 2024

    @dipeshmsft
    Member

    @fraluderin , there is a style defined for TextBoxBase in Fluent control styles, DefaultTextBoxBaseStyle. I haven't checked it yet, but this shall load the TextBox without the clear button.

        <TextBox Style="{StaticResource DefaultTextBoxBaseStyle}" Width="200" Height="50" Margin="5" />
    
  4. added and removed
    API suggestion
    on Dec 18, 2024
  5. self-assigned this
    on Dec 18, 2024
  6. fraluderin commented on Jan 6, 2025

    @fraluderin
    Author

    @dipeshmsft Yes you're right, I checked it now and it works. I added this in my TextBox XAML:

    Style="{StaticResource DefaultTextBoxBaseStyle}"

    Image

    I have no sufficient experience to help you decide which should be the default behavior (show or not the clear button in a TextBox).

  7. dipeshmsft commented on Jan 9, 2025

    @dipeshmsft
    Member

    Thanks for the update @fraluderin.

    I will go ahead and close this issue now, but I will add the reference to this issue is another bug that tracks other Fluent issues.

  8. locked and limited conversation to collaborators on Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions