'MenuFlyoutItem.KeyboardAccelerators fires Invoked event twice
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()}");
}
}
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.
If you want to test the application follow this link enter link description here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
