[C# UWP] FileOpenPicker opens twice with keyboard accelerators RRS feed

  • Question

  • I would like to add keyboard shortcuts to some buttons. But for some reason the keyboard accelerator triggers the event twice. When I just click the button with the mouse, it works as expected.

            <MenuBarItem Title="File">
                <MenuFlyoutItem Text="Open file..." Click="OnOpen" Icon="OpenFile">
                        <KeyboardAccelerator Key="O" Modifiers="Control"/>

    FileLoader.LoadFile here shows the FileOpenPicker:

    private async void OnOpen(object sender, RoutedEventArgs e)
       if (!Busy)
            var loadedFile = await FileLoader.LoadFile(".txt", PickerLocationId.Desktop);
             if(loadedFile != null)
                     await FileLoader.LoadTextFile(loadedFile);

    The same problem is happening with a FileSavePicker elsewhere in my code.

    How can I prevent this from happening?

    Saturday, August 15, 2020 6:08 PM

All replies

  • Hi,

    This forum only handles questions about how to submit and publish UWP apps. Your questions of developing UWP apps is out of the scope of current forum. You could ask questions about UWP development in Microsoft Q&A with windows-uwp tag.

    Best regards,


    "Developing Universal Windows apps" forum will be migrating to a new home on Microsoft Q&A (Preview)!
    We invite you to post new questions in the "Developing Universal Windows apps" forum’s new home on Microsoft Q&A (Preview)!
    For more information, please refer to the sticky post.

    Monday, August 17, 2020 3:38 AM