Skip to content

Conversation

@snechaev
Copy link
Contributor

This PR improves the look and behavior of the main window main menu items visual and behavior:

  • InputGesture attributes added to display the associated hotkeys
  • manual handling of the menu items hotkeys removed from the main window KeyUp handler to prevent the corresponding actions to be called twice (first time the MenuItem.HotKey calls associated action, then KeyUp calls the same action again). Fixes [avalonia] Build called twice when Shift+F6 hotkey is used #904

…n the UI. The HotKey attribute must still be set for hotkeys to be handled automatically.
…d prevent the menu-attached actions from being called twice. Fixes KirillOsenkov#904.
@snechaev
Copy link
Contributor Author

snechaev commented Sep 23, 2025

Note: for now, the MainWindow.xaml contains some copy&paste like this

                <MenuItem Name="Open"
                          Header="_Open Log..."
                          HotKey="Ctrl+O"
                          InputGesture="Ctrl+O"/>

(the Ctrl+O constant written twice).

This can be replaced with something like

                <MenuItem Name="Open"
                          Header="_Open Log..."
                          HotKey="Ctrl+O"
                          InputGesture="{Binding HotKey, RelativeSource={RelativeSource Self}}"/>

This is way more wordy, but it prevents non-synchronous changes to the HotKey and InputGesture attributes.
I can update the PR with such a changes if needed.

@KirillOsenkov KirillOsenkov merged commit d4300eb into KirillOsenkov:main Sep 23, 2025
1 check 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.

[avalonia] Build called twice when Shift+F6 hotkey is used

2 participants