hide "Remove from Quick Access Toolbar"

Ribbon for WPF Forum

Posted 15 years ago by johannes. g.
Version: 4.5.0487

is there a way to hide the possibility "Remove from Quick Access Toolbar" on a control in the QAT which is not a clone of a control in the application menu?

in my situation, when i click "Remove from Quick Access Toolbar" the button disappears and i never get it back.. :(

thanks in advance.

Comments (2)

Posted 15 years ago by Actipro Software Support - Cleveland, OH, USA
I think what you could do is handle the ContextMenuOpening event for that control and the ContextMenu would probably have been created already by our code by the time it hits your handler. So you could remove that menu item before it displays.

Actipro Software Support

Posted 15 years ago by johannes. g.
thanks a lot!

here is my code (i am using the Id property to identify the button i want to manipulate):

EventManager.RegisterClassHandler(typeof(UIElement), ContextMenuOpeningEvent, new ContextMenuEventHandler(OnContextMenuOpeningEvent));

private void OnContextMenuOpeningEvent(object sender, ContextMenuEventArgs e)
  var button = sender as Button;
  if (button == null) return;
  if (button.Id != "MyButtonId") return;

  var menu = button.ContextMenu.Items[0] as Menu;
  menu.Items.RemoveAt(0); // remove "Remove from Quick Access Toolbar"
  menu.Items.RemoveAt(0); // remove splitter

The latest build of this product (v24.1.2) 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.