WPF Ribbon - Hide quick access toolbar

前端 未结 6 1038
野趣味
野趣味 2021-02-19 05:26

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

6条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-19 05:49

    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

提交回复
热议问题