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

Multiple levels of menu items of DropDownButton behaves not well #1087

Closed
orrindeng opened this issue Dec 2, 2022 · 1 comment
Closed

Multiple levels of menu items of DropDownButton behaves not well #1087

orrindeng opened this issue Dec 2, 2022 · 1 comment
Labels
Milestone

Comments

@orrindeng
Copy link
Contributor

Hello guys,

Originally, I met an issue that clicking the menu item will close the sub menu. And later I found a bug if there are a more than two levels of sub menu. The third sub menu will show when mouse button down and close when mouse button up.
image

We found we have code like this.

    protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
    {
        if (e.ClickCount == 1)
        {
            if (this.IsSplited)
            {
                if (this.GetTemplateChild("PART_ButtonBorder") is Border buttonBorder
                    && PopupService.IsMousePhysicallyOver(buttonBorder))
                {
                    this.OnClick();
                }
            }
            else if (this.HasItems)
            {
                this.IsSubmenuOpen = !this.IsSubmenuOpen;
            }
        }

        base.OnMouseLeftButtonUp(e);
    }

I looked into the dotnet WPF source code. MenuItem
And found that the base WPF MenuItem will show the sub menu when mouse down. But we will close it when mouse up with this.IsSubmenuOpen = !this.IsSubmenuOpen .

@orrindeng
Copy link
Contributor Author

I've created a pull request to remove this behavior. Please feel free to decline it if it's not good. Thanks.

@batzen batzen added the Bug 🐞 label Dec 7, 2022
@batzen batzen added this to the 10.0 milestone Dec 7, 2022
batzen added a commit that referenced this issue Dec 7, 2022
@batzen batzen closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants