How to completely remove the QuickAccessToolbar and free the space?

Ribbon for WPF Forum

Posted 6 years ago by Charles Feng
Version: 13.1.0583
Avatar

Hi,

Even if I set QuickAccessToolBarLocation="None", although the toolbar is invisible, the space it takes (the blank row) is still there, in between the Ribbon control and the window frame.

How do I completely remove the QAT space?

Note that I am using a normal window containing a Ribbon control, not a RibbonWindow. The reason is that I cannot apply WindowChrome to a RibbonWindow (as per documentation).

 

Thanks

Charles

[Modified 6 years ago]

Comments (5)

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Charles,

Sorry but that space is required because contextual tab groups can render their headers up there as well.

And actually, RibbonWindow (in 2013.1 at least) does use a WindowChrome behind the scenes.  While you should not set a new WindowChrome instance on the window in XAML since that could cause issues, you can get the existing instance with WindowChome.GetChrome method.


Actipro Software Support

Posted 6 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Avatar

Can the width be set to 0 at least (as well as the application icon)?  In trying to implement 2013-style auto-hide behavior, I've found I can't get the restore/ellipsis button to span the width of the window because the App Icon and QAT never fully collapse even when the ApplicationIcon is set to null and QuickAccessToolBarLocation is set to None.

Incidentally, if the application opens without Icon set and then one is applied, the Icon and the QAT will overlap:

<ribbon:RibbonWindow x:Class="WpfApplication5.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:ribbon="http://schemas.actiprosoftware.com/winfx/xaml/ribbon" xmlns:local="clr-namespace:WpfApplication5"  Title="MainWindow" Height="350" Width="525">
    <ribbon:RibbonWindow.Resources>
        <local:IconConverter x:Key="IconConverter" />
    </ribbon:RibbonWindow.Resources>
    <ribbon:RibbonWindow.Icon>
        <Binding RelativeSource="{RelativeSource Self}" Path="RibbonState" Converter="{StaticResource IconConverter}" />
    </ribbon:RibbonWindow.Icon>
    <ribbon:Ribbon>
        <ribbon:Tab Label="Tab">
            <ribbon:Group Label="Group">
                <ribbon:Button Click="Button_Click" ImageSourceLarge="ToyVortininja.png"/>
            </ribbon:Group>
        </ribbon:Tab>
        <ribbon:Tab Label="Tab 2" />
        <ribbon:Tab Label="Tab 3" />
    </ribbon:Ribbon>
</ribbon:RibbonWindow>

 

    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void Button_Click(object sender, ActiproSoftware.Windows.Controls.Ribbon.Controls.ExecuteRoutedEventArgs e)
        {
            RibbonState = string.Equals("AutoHide", RibbonState, StringComparison.Ordinal) ? "Normal" : "AutoHide";
        }
        
        public string RibbonState
        {
            get { return (string)GetValue(RibbonStateProperty); }
            set { SetValue(RibbonStateProperty, value); }
        }

        public static readonly DependencyProperty RibbonStateProperty = DependencyProperty.Register("RibbonState", typeof(string), typeof(MainWindow), new PropertyMetadata("AutoHide"));
    }

 

    internal sealed class IconConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string ribbonState = (string)value;
            return string.Equals(ribbonState, "AutoHide", StringComparison.Ordinal) ? null : new BitmapImage(new Uri("pack://application:,,,/WpfApplication5;component/ToyVortininja.png", UriKind.RelativeOrAbsolute));
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }

[Modified 6 years ago]

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Owen,

Right now RibbonWindow isn't set up to support Office 2013-like auto-hide.  You'd need to probably provide the RibbonWindow with a custom alternate template to support that sort of thing.  Your custom template would need to modify ours to include the "..." button when auto-hide mode is active and adjust the rest of the window UI as appropriate for that mode.

Then you'd also need to make a Window-title-bar-like popup that renders the window's icon, title, system buttons, and has a ribbon in it.


Actipro Software Support

Posted 6 years ago by Owen Christensen - Software Engineer, Minitab Inc.
Avatar

OK that's kind of what we were figuring the answer would be and have started down that path.  Is 2013 ribbon behavior on a short-term backlog for you guys?  Like something we'd see in the next quarterly?

Posted 6 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Owen,

We have it down on the TODO list and will see how many customers want auto-hide features.  That feature is tricky because it involves the window being aware of where the ribbon is and also being able to pull the ribbon out of the window's UI (to put it in the auto-hide popup) and then put it back in the window later (where possible parent controls our of our control may have changed, etc.).  That aspect of it makes things rather difficult.


Actipro Software Support

The latest build of this product (v2018.1 build 0675) 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.