Skip to content

Commit

Permalink
Merge pull request #1043 from andersforsgren/menuitem-createqatitem-fix
Browse files Browse the repository at this point in the history
Fixes #1041 by making MenuItem create ToggleButton on QAT
  • Loading branch information
batzen authored Jul 5, 2022
2 parents a7446aa + 3e9af72 commit b48b3e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Fluent.Ribbon.Showcase/TestContent.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1913,7 +1913,8 @@
LargeIcon="{iconPacks:Material Kind=Cog}">
<Fluent:MenuItem Header="First (with icon)"
GroupName="{Binding Converter={StaticResource UniqueGroupNameConverter}, ConverterParameter=MenuItemGroup1}"
Icon="Images/Pink.png"
Icon="Images/Pink.png"
CanAddToQuickAccessToolBar="True"
IsCheckable="True"
IsChecked="True" />
<Fluent:MenuItem Header="Second"
Expand Down
18 changes: 14 additions & 4 deletions Fluent.Ribbon/Controls/MenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,20 @@ public virtual FrameworkElement CreateQuickAccessItem()
}
}
else
{
var button = new Button();
RibbonControl.BindQuickAccessItem(this, button);
return button;
{
if (this.IsCheckable)
{
var toggleButton = new ToggleButton();
RibbonControl.Bind(this, toggleButton, nameof(this.IsChecked), System.Windows.Controls.Primitives.ToggleButton.IsCheckedProperty, BindingMode.TwoWay);
RibbonControl.BindQuickAccessItem(this, toggleButton);
return toggleButton;
}
else
{
var button = new Button();
RibbonControl.BindQuickAccessItem(this, button);
return button;
}
}
}

Expand Down

0 comments on commit b48b3e4

Please sign in to comment.