Skip to content

Add Fluent Ribbon QuickAccess item in code behind #1211

Answered by batzen
Rickyd56 asked this question in Q&A
Discussion options

You must be logged in to vote

There is no need to set the icon etc. on the menu item directly.
Just use

QuickAccessMenuItem AddMenuItem = new QuickAccessMenuItem();
Fluent.Button AddButton = new Fluent.Button();
AddButton .Header = "Test";
AddButton .Icon = "images/button.png";
AddButton .Click += new RoutedEventHandler(btnProgram1_Click);

AddMenuItem.Target = AddButton;

AddMenuItem.IsChecked = true;

Ribbon1.QuickAccessItems.Add(AddMenuItem);

That should work.
Instead of adding a click handler you could also use a command.

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@batzen
Comment options

Answer selected by batzen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants