Visual improvements for RibbonQuickAccessToolBar

Here are couple of scenarios that can be improved.

  • The contents of the QuickAccessToolBar show far too low within the title area of the window.
  • It is preferable that the left and right separators for a RibbonQuickAccessToolBar not show if this ToolBar is empty.

Find attached a workaround app for the two cases outlined above.

  • The first scenario is mitigated by introducing some negative margin to position the contents of the QuickAccessToolBar higher within the title bar.
  • The second scenario is mitigated by toggling the visiblity of the separators based upon the RibbonQuickAccessToolBar.HasItems property.

WpfRibbonApplication5.zip

Comments

  • Anonymous
    August 25, 2010
    I have a QuickAccessToolbar in my XAML.  Running your solution the toolbar simply dissappears.  I see that in your code-behind you simply overwrite this like so: private void CreateQat() {     Ribbon.QuickAccessToolBar = new RibbonQuickAccessToolBar(); } How do I use your solution? Thanks.

  • Anonymous
    September 01, 2010
    @ipp_austin: The reason I created an instance of a QuickAccessToolBar in code was for the case where there is no QuickAccessToolBar in XAML. In your case you can modify that piece of code to simply fetch the instance you set in XAML by querying ribbon.QuickAccessToolBar. Hope that helps.

  • Anonymous
    September 16, 2010
    Since my last post seems to have gotten eaten by the void... The workaround for the QuickAccess buttons being shown too low doesn't seem to quite get it correct. It also changes the seperators around the quick access buttons making them smaller (and changing their position too, I think), and it seems to not move the buttons up quite far enough. After tinkering with the code a bit, I got it to look a bit better, but the solution was less than elegant.  Here's the code I used (hopefully the blog software won't destroy the formatting): private void UpdateQatTopHostPresenterMargin() {    Grid rootElement = VisualTreeHelper.GetChild(Ribbon, 0) as Grid;    if (rootElement != null)    {        rootElement.ClipToBounds = false;    }    ContentPresenter qatTopHostPresenter = Ribbon.Template.FindName("QatTopHostContentPresenter", Ribbon) as ContentPresenter;    if (qatTopHostPresenter != null)    {        qatTopHostPresenter.Margin = new Thickness(0, -8, 0, 0);    }    UpdateTopHostBorder("QatTopHostLeftBorder");    UpdateTopHostBorder("QatTopHostRightBorder"); } private void UpdateTopHostBorder(string topHost) {    Border qatTopHostBorder = Ribbon.Template.FindName(topHost, Ribbon) as Border;    if (qatTopHostBorder != null)    {        Thickness updatedMargin = qatTopHostBorder.Margin;        updatedMargin.Top -= 1.0;        qatTopHostBorder.Margin = updatedMargin;        qatTopHostBorder.Height = 15;    } }