Skip to content

Allow triple left click on a TextBox to select all text - #4081

Open
JLdgu wants to merge 1 commit into
MaterialDesignInXAML:masterfrom
JLdgu:master
Open

Allow triple left click on a TextBox to select all text#4081
JLdgu wants to merge 1 commit into
MaterialDesignInXAML:masterfrom
JLdgu:master

Conversation

@JLdgu

@JLdgu JLdgu commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Triple clicking in a textbox to select all text is a common action on Windows applications

@corvinsz corvinsz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I few things I noticed:

  1. We should type check against TextBoxBase so this behavior also works for the RichTextBox
  2. Maybe an example dedicated to this attached property with a small description would be helpful, especially because this behavior is not something consumers can "just see". Please don't forget the MD3 demo app 😄
  3. In my opinion the test you added should also test the negative (materialDesign:TextFieldAssist.SelectAllOnTripleClick="False") behavior to prevent any regressions.

DependencyObject d,
DependencyPropertyChangedEventArgs e)
{
if (d is TextBox textBox)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (d is TextBox textBox)
if (d is TextBoxBase textBox)

object sender,
MouseButtonEventArgs e)
{
if (e.ClickCount == 3 && sender is TextBox textBox)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if (e.ClickCount == 3 && sender is TextBox textBox)
if (e.ClickCount == 3 && sender is TextBoxBase textBox)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants