-
Notifications
You must be signed in to change notification settings - Fork 677
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
Question: How to use menuflyout in CommandBarFlyout with touch screen #2040
Comments
That's a bug. |
This definitely feels like a bug. Seems that CommandBarFlyout is a bit too aggressive in closing when it loses focus. I tried changing its ShowMode and also tried setting the button's AllowFocusOnInteraction property to False but neither helped. @zhuxb711 one thing to try is replacing your AppBarButton with attached Flyout with: <AppBarElementContainer>
<MenuFlyoutSubItem Text="Open with..." Icon="AllApps">
<MenuFlyoutItem />
<MenuFlyoutItem />
</MenuFlyoutSubItem>
</AppBarElementContainer> I saw two problems with this approach but am curious if this might work for your scenario.
Please give this a try and we may need to open some follow-up issues to track all this. |
I tried it according to your method, but there are some problems, including: the icon does not render correctly, it is shorter than the entire CommandBarFlyout. In addition, although it works correctly under the touch screen, it cannot be closed once it is expanded like this: |
@YuliKl Is there any progress on the fix for this issue? |
@llongley any thoughts on a fix for this issue ? |
Is there any progress now? When will this be fixed? |
@zhuxb711 I got some time and looked into this issue today. The bug in CommandBarFlyout is caused by this line. Normally when we attach the close function to the secondary item's click events we ignore the buttons which have flyout to prevent the closing behavior you are seeing. However it looks like we forgot to include that in this particular case. I will send out a PR to fix this soon, but if you need a work around to use before we publish a new Winui 2 prerelease/release let me know. You could probably work around the bug by inserting your menu items with flyouts into the collection after the fact so that they are treated by the vector changed code path which has the bug fix. Although I haven't tested this work around. |
There is an additional issue where invoking a button from a flyout of a secondary command (with any input) doesn't close the CommandBar. Fixing this will be a little bit trickier, I've opened issue #3052 to track |
Clicking a button with flyout will still cause the commandbarflyout to close in 2.5.0-prerelease.200923002 |
Sorry, now I can confirm that the problem has been properly resolved |
If the mouse pointer is placed on MenuFlyout in a mouse environment, it will automatically open and work fine. However, in a touch screen environment, it must be clicked to expand MenuFlyout, but CommandBarFlyout will automatically close at this time, so MenuFlyout cannot be expanded in a touch screen environment. I want to know if there is any way to make the touch screen work properly?
Here is mouse:
Here is touch screen:
Here is my example code:
The text was updated successfully, but these errors were encountered: