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

MenuFlyoutItem.KeyboardAccelerators fires Invoked event twice #6488

Closed
1 of 2 tasks
HarutyunDokhoyan opened this issue Dec 17, 2021 · 2 comments
Closed
1 of 2 tasks

Comments

@HarutyunDokhoyan
Copy link

Describe the bug

I have implemented MenuFlyoutItem.KeyboardAccelerators and below you can see the code

Xaml code

        <Button Content="Edit Options"
            Width="100"
            Height="100"
            HorizontalAlignment="Right">
        <Button.Flyout>
            <MenuFlyout>
                <MenuFlyoutItem x:Name="FlyoutItem1" Text="Copy" Icon="Copy">
                    <MenuFlyoutItem.KeyboardAccelerators>
                        <KeyboardAccelerator x:Name="Test" Key="C" Modifiers="Control" Invoked="Test_Invoked" />
                    </MenuFlyoutItem.KeyboardAccelerators>
                </MenuFlyoutItem>
                <MenuFlyoutSeparator/>
            </MenuFlyout>
        </Button.Flyout>
    </Button>

Code-Behind

    public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();
    }
    private void Test_Invoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
    {
        Debug.WriteLine($">>>>>>>>>>>>>>>>>>>>>>>>>>>>> invoked Hash = {sender.GetHashCode()}");
    }
}

Steps to reproduce the bug

Before clicking on the button in the application, the CTRL+C hotkey action fires an event. But when I click on the button and MenuFlyout appears, the Ctrl+C hotkey action fires twice the same event. And when I click on another place in the application event again fires normally only once.

Expected behavior

The CTRL+C hotkey action fires an event only once.

Screenshots

No response

NuGet package version

Microsoft.UI.Xaml 2.5.0

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

May 2021 Update (19043)

Additional context

No response

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 17, 2021
@StephenLPeters
Copy link
Contributor

@bpulliam and @JesseCol this sounds familiar... thoughts?

@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@github-actions
Copy link

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.

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

No branches or pull requests

3 participants