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

MenuItem CreateQuickAccessItem should create ToggleButton #1041

Closed
andersforsgren opened this issue Jul 4, 2022 · 2 comments · Fixed by #1043
Closed

MenuItem CreateQuickAccessItem should create ToggleButton #1041

andersforsgren opened this issue Jul 4, 2022 · 2 comments · Fixed by #1043
Labels
Milestone

Comments

@andersforsgren
Copy link

The Fluent.MenuItem class when there are no child menu items, produces a regular Button as its QuickAccessItem.

This means the MenuItem.IsChecked is not reflected as the toggle state on the QAT button.

current impl in MenuItem.cs

else // no child items 
{
    var button = new Button();
    RibbonControl.BindQuickAccessItem(this, button);
    return button;
}

I suggest this should instead return a ToggleButton. The rationale being that a MenuItem, being checkable, is more similar to a ToggleButton than a Button.

So basically instead, this:

else // no child items 
{
    var button = new ToggleButton();
    RibbonControl.Bind(this, button, nameof(this.IsChecked), IsCheckedProperty, BindingMode.TwoWay);
    RibbonControl.BindQuickAccessItem(this, button);
    return button;
}

If this looks reasonable I’m happy to supply a PR


Environment

  • Fluent.Ribbon v9..0.4
  • Windows 10 21H2
  • .NET Framework 4.8
@batzen
Copy link
Member

batzen commented Jul 4, 2022

Actually both would be wrong alone, as the result should depend on the check ability of the menu item. 😉

@batzen batzen added the Bug 🐞 label Jul 4, 2022
@batzen batzen added this to the 10.0 milestone Jul 4, 2022
@andersforsgren
Copy link
Author

Yes I suppose the correct way would be to make it conditional on IsCheckable and make either a Button or a ToggleButton?

I will give it a try

andersforsgren pushed a commit to andersforsgren/Fluent.Ribbon that referenced this issue Jul 5, 2022
batzen added a commit that referenced this issue Jul 5, 2022
Fixes #1041 by making MenuItem create ToggleButton on QAT
batzen added a commit that referenced this issue Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants