Skip to content
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

fixes #3654 - NumericUpDown not focusable by pressing tab #3656

Merged

Conversation

corvinsz
Copy link
Contributor

set IsTabStop to False on the default NumericUpDown control style

@corvinsz
Copy link
Contributor Author

removed setting IsTabStop again.
Instead added an eventhandler for GotFocusEvent to move the focus to the PART_TextBox when the NumericUpDown has gotten focus.

When the control gets focused, all the text of the PART_TextBox gets selected via SelectAll(). It's debatable if that should be a thing or not. I decided to go with it because that's how the default WPF DatePicker handles it.

if ((!e.Handled) && (numericUpDown._textBoxField != null))
{
numericUpDown._textBoxField.Focus();
numericUpDown._textBoxField.SelectAll();
Copy link
Member

Choose a reason for hiding this comment

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

Though I typically like this SelectAll behavior on my apps I am hesitant to add it to the control by default. What about simply adding a new SelectAll method to this control so that apps can call it if they want that behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, as I stated above it's debatable if SelectAll should be called inside of the event handler or not.
I guess with your suggestion we get the best of both worlds.

@Keboo
Copy link
Member

Keboo commented Aug 29, 2024

Hey @corvinsz, while reviewing your PR, I'd suggest the following code changes:

👉 Code Suggestion for #3656

#3656

You can also review and apply these suggestions locally on your machine.

Learn more about GitKraken Code Suggest

Code Suggest liberates your code reviews from GitHub's restrictive, comment-only feedback style. As simple as suggesting changes in a Google-doc, provide real code suggestions from where you code, e.g. your IDE, and on anything in your project — not just on the lines of code changed in the PR.

Join your team on GitKraken to speed up PR review.

Copy link
Contributor

This PR is marked stale because it has been open 60 days with no activity. Remove stale label or update the PR, otherwise it will be closed in 14 days.

@github-actions github-actions bot added the Stale Issues and PRs that have not had activity for a while are marked with this label. label Oct 29, 2024
@Keboo Keboo removed the Stale Issues and PRs that have not had activity for a while are marked with this label. label Oct 31, 2024
@Keboo Keboo self-assigned this Nov 25, 2024
@Keboo Keboo added this to the 5.2.0 milestone Nov 25, 2024
…ult NumericUpDown control

focus PART_TextBox of NumericUpDown control if it gets focus and enable moving focus with tab (and shift+tab) MaterialDesignInXAML#3654. Also removed the IsTapStop on the Template because that is not longer needed

renamed variable (copy paste mistake)

Applying code suggestions
31659b
@Keboo Keboo force-pushed the fix3654NumericUpDownFocus branch from 57ddd41 to 528695c Compare January 3, 2025 05:50
@Keboo Keboo enabled auto-merge (squash) January 3, 2025 05:50
@Keboo Keboo merged commit b702bc8 into MaterialDesignInXAML:master Jan 3, 2025
2 checks passed
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