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

Fix not working hotkey on a custom control. closes #12323 #12347

Merged
merged 2 commits into from
Aug 2, 2023
Merged

Fix not working hotkey on a custom control. closes #12323 #12347

merged 2 commits into from
Aug 2, 2023

Conversation

flexxxxer
Copy link
Contributor

What does the pull request do?

Registration of hotkeys for controls that do not implement Avalonia.Input.IClickableControl but implement Avalonia.Input.ICommandSource is possible now.

What is the current behavior?

Current behavior is broken/regression compare to Avalona v0.10. Currently, in Avalonia v11, you can declare type HotKeyedTextBox inherited from Avalonia.Controls.TextBox with implemented HotKey property, but it will not work, but in Avalonia v0.10 it will work. Example with working hotkey registration for custom type HotKeyedTextBox inherited from Avalonia.Controls.TextBox for Avalonia v0.10.21 and not working hotkey registration for custom type HotKeyedTextBox inherited from Avalonia.Controls.TextBox for Avalonia V11 here. Curren behavior was created by #7500.

What is the updated/expected behavior with this PR?

When declaring of custom control with proper implementation of HotKey property possible and hotkey working as expected, like in Avalonia v0.10.

How was the solution implemented (if it's not obvious)?

In Avalonia.Controls.HotKeyManager.HotKeyManager() (static constructor) condition has been changed from if (control is not IClickableControl) to if (control is not IClickableControl and not ICommandSource).

Checklist

Breaking changes

None

Obsoletions / Deprecations

None

Fixed issues

Fixes #12323

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038149-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@flexxxxer
Copy link
Contributor Author

@microsoft-github-policy-service agree

@flexxxxer
Copy link
Contributor Author

@flexxxxer please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@dotnet-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@dotnet-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@dotnet-policy-service agree company="Microsoft"

Contributor License Agreement

@dotnet-policy-service agree

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038216-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-team
Copy link
Contributor

You can test this PR using the following package version. 11.0.999-cibuild0038264-beta. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 added this pull request to the merge queue Aug 2, 2023
Merged via the queue into AvaloniaUI:master with commit 4d6cd42 Aug 2, 2023
@flexxxxer flexxxxer mentioned this pull request Aug 2, 2023
3 tasks
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.

[Regression] Can't add a hotkey to a custom control
3 participants