Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Ribbon - Hide quick access toolbar

Tags:

wpf

ribbon

how do you hide Quick Access Toolbar in a WPF's Ribbon?

like image 373
redman Avatar asked Jun 07 '11 12:06

redman


2 Answers

For Microsoft Ribbon for WPF, you can hide it by using the VisualTreeHelper. On the Loaded event handler, just resize the row containing the Quick Access Toolbar to 0 :

private void RibbonLoaded(object sender, RoutedEventArgs e)
{
  Grid child = VisualTreeHelper.GetChild((DependencyObject)sender, 0) as Grid;
  if (child != null)
  {
    child.RowDefinitions[0].Height = new GridLength(0);
  }
}

enter image description here

like image 136
Philippe Lavoie Avatar answered Oct 04 '22 02:10

Philippe Lavoie


The Quick Access Toolbar is automatically hidden when the Ribbon control is in a RibbonWindow. When it is not, it seems impossible to hide it. I have already worked hours on this issue and was unable to hide it properly. But there is one simple workaround: Place the Ribbon control inside of a Panel and give it a negative top margin so it will slide outside of the Panel. Set the Panel's ClipToBounds property to true and the QAT will be hidden. By the way - there are multiple Ribbon implementations for WPF, even by Microsoft themselves ("Fluent Ribbon" and "Microsoft Ribbon for WPF"), so next time you should mention which one you are talking about.

like image 41
Daniel Albuschat Avatar answered Oct 04 '22 00:10

Daniel Albuschat