Accessing Quick Access Toolbar at runtime

Ribbon for WPF Forum

Posted 12 years ago by Brad Daszynski
Version: 1.0.0347
Avatar
Hi. I am trying to be able to access the Quick Access Toolbar at runtime, so that users can customize what items are actually in the toolbar. In XAML, I've specified items easily, such as:

<ribbon:Ribbon.QuickAccessToolBarItems>
<ribbon:Button Command="ApplicationCommands.Cut" />
<ribbon:Button Command="ApplicationCommands.Copy" />
<ribbon:Button Command="ApplicationCommands.Paste" />
</ribbon:Ribbon.QuickAccessToolBarItems>

but how would I add/remove items dynamically in procedural code? Thanks.

Comments (3)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Brad,

Yes, something like this works:
RibbonControls.Button button = new RibbonControls.Button(System.Windows.Input.ApplicationCommands.Paste);
ribbon.QuickAccessToolBarItems.Add(button);


Actipro Software Support

Posted 12 years ago by Brad Daszynski
Avatar
I added a button successfully, and set the foreground to White, but it still appears as black. Any ideas?

Also, how would I set the ImageSourceSmall or ImageSourceLarge in code?

Many thanks.

[Modified at 08/28/2007 09:21 AM]
Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Good find, we'll update the styles to use the Foreground property setting for the next maintenance release.

They take any valid ImageSource, although generally people will use a BitmapImage. The MSDN info on BitmapImage has some sample code for loading it programmatically.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.