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

After Upgrading to VS 2022 version 17.9.0, ToggleMenuFlyoutItem tapped event no longer fires. #9357

Closed
johnt-star opened this issue Feb 21, 2024 · 2 comments
Labels
area-Flyouts needs-triage Issue needs to be triaged by the area owners team-CompInput Issue for IXP (Composition, Input) team

Comments

@johnt-star
Copy link

Describe the bug

My project contains numerous command bars that consist of various AppBarButtons.

Some of the AppBarButtons use a MenuFlyout to display options in the form of ToggleMenuFlyOutItems

When the user taps the AppBarButton, the MenuFlyout displays the ToggleMenuFlyoutItems.

Then tapping the ToggleMenuFLyoutItems will fire its tapped event handler.

Since upgrading to VS 17.9.0, this tapped event is no longer fired.

Steps to reproduce the bug

I am including a very simple project displaying the issue.

The project has a command bar as a child of the main page's StackPanel.

At start up, the project will create an AppBarButton and add a MenuFlyout with 3 ToggleMenuFlyoutItems.

Each ToggleMenuFlyoutItem tapped event handler is wired up to point to the same event handler.

The AppBarButton is then added to the CommandBar's PrimaryCommands' collection.

When the project starts up, the AppBar button is displayed in the CommandBar.

Clicking the AppBarButton displays the ToggleMenuFlyoutItems.

However, clicking a ToggleMenuFlyoutItem does not fire the tapped event handler.

This is confirmed by placing a break point within the event handler, which is never hit.

Expected behavior

The ToggleMenuFlyoutItem event handler should fire each time a ToggleMenuFlyoutItem is tapped.

Screenshots

image

Project main screen showing AppBarButton within CommandBar

image

Tapping AppBarButton displays ToggleMenuFlyoutItems

image

Breakpoint never reached

image

VS Details

NuGet package version

None

Packaging type

No response

Windows version

Windows 10 version 22H2 (19045, 2022 Update)

IDE

Visual Studio 2022

Additional context

Attaching sample project

CommandBarEventHandler.zip

@johnt-star johnt-star changed the title Afetr Upgrading to VS 2022 version 17.9.0, ToggleMenuFlyoutItem tapped event no longer fires. After Upgrading to VS 2022 version 17.9.0, ToggleMenuFlyoutItem tapped event no longer fires. Feb 21, 2024
@codendone codendone transferred this issue from microsoft/WindowsAppSDK Feb 22, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 22, 2024
@codendone codendone added area-Flyouts team-CompInput Issue for IXP (Composition, Input) team and removed needs-triage Issue needs to be triaged by the area owners labels Feb 22, 2024
@kmahone
Copy link
Member

kmahone commented Feb 26, 2024

For this scenario, use the Click event instead of the Tapped event.

The api names are little confusing. "Click" should really be called "Invoked", since it will be raised in response to any user interaction that invokes the item (mouse, touch, keyboard, UIA, etc.).

In general it is best to avoid using the base input events defined on UIElement on the various controls and instead it is best to use the events defined on the control itself. I don't know why Tapped stopped working in this case (likely a change in the control's template is interfering with the gesture recognizer), but Click should work reliably.

@kmahone kmahone closed this as completed Feb 26, 2024
@johnt-star
Copy link
Author

Thank you for the update!

I shall stop using the Tapped event and start using the Click event.

I have other controls that use the Tapped event, that still work.

However, based on your comment, I shall move all Tapped events to Click events.

On a side note, there is a Double-Tapped event, but not a Double-Click event.

That is why I went with Tapped Event in the first place.

Like you said, confusing.

@microsoft-github-policy-service microsoft-github-policy-service bot added the needs-triage Issue needs to be triaged by the area owners label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Flyouts needs-triage Issue needs to be triaged by the area owners team-CompInput Issue for IXP (Composition, Input) team
Projects
None yet
Development

No branches or pull requests

3 participants