Skip to content

Conversation

@Koichi-Kobayashi
Copy link
Contributor

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?

The buttons were not receiving focus, and pressing the spacebar or Enter key did not produce any response.

Issue Number: N/A

What is the new behavior?

  • Add checkIsFocused parameter to SetFocusToFirstAvailableButton method to control focus validation based on timing
  • Call SetFocusToFirstAvailableButton with checkIsFocused: false in OnLoaded and OnApplyTemplate to attempt early focus setting
  • Call SetFocusToFirstAvailableButton with checkIsFocused: true in OnContentRendered to respect developer's focus logic
  • Skip focus setting if focus is already on any button
  • Skip focus setting if focus is on a non-button control (e.g., TextBox)
  • Set focus to primaryButton when focus is on MessageBox itself or nowhere
  • Add Gallery sample demonstrating auto-focus behavior when no button or non-button control has focus

Other information

Default focus settings are now available.
2025-12-18_00h23_36

- Add checkIsFocused parameter to SetFocusToFirstAvailableButton method
  to control focus validation based on timing
- Call SetFocusToFirstAvailableButton with checkIsFocused: false in
  OnLoaded and OnApplyTemplate to attempt early focus setting
- Call SetFocusToFirstAvailableButton with checkIsFocused: true in
  OnContentRendered to respect developer's focus logic
- Skip focus setting if focus is already on any button
- Skip focus setting if focus is on a non-button control (e.g., TextBox)
- Set focus to primaryButton when focus is on MessageBox itself or nowhere
- Add Gallery sample demonstrating auto-focus behavior when no button or
  non-button control has focus
@github-actions github-actions bot added controls Changes to the appearance or logic of custom controls. styles Topic is related to styles PR Pull request gallery WPF UI Gallery dotnet release labels Dec 17, 2025
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 gallery WPF UI Gallery 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