Question

Salam,

Can any one help me please with the WPF Ribbon, I noticed that when you give the window that contains the ribbon control height less than 250 the ribbon auto collapse. after it auto collapses if you explicitly set it's visibility to Visible only the title bar is shown without the tabs. Any means to stop this behavior?

Was it helpful?

Solution

I found the answer:

This is a built in behavior of the newly released Microsoft Ribbon: the containing window is stored in the Ribbon object and the Ribbon collapses When the width of the window is under 300, OR the height of the window is under 250, the purpose is of course is that when space is scarce, priority is given to the document, not the Ribbon. Same behavior is found in Word and Excel ribbons.

There is no streightforward way of overriding this behaviour but you can do the following:

1 - Download and install the Source and Sample installer from this page.

2 - Find the RAR file containing the solution.

3 - Extract and open the solution.

4 - Find the Ribbon class (should be in RibbonsControlsLibrary project)

You can examine the implementation of the class from here, you can see there are two constants in the beginning of the class that are causing the issue.. You might even consider changing the code and rebuilding the whole project if nothing else works.

public class Ribbon : Selector
{
      private const double CollapseWidth = 300.0; // The minimum allowed width before the Ribbon will be collapsed.
      private const double CollapseHeight = 250.0; // The minimum allowed height before the Ribbon will be collapsed.

      //....
}

Original solution post

OTHER TIPS

I think Microsoft claims that u are not allowed to change the code, but only to view it for e.g. presentations - so probably it would not be a good idea to change and rebuild it...

Why you need this, I think what you need is not supported because Microsoft did not intended for the Ribbon control te be used in a way other than what we can see on Office 2007 or 2010.

Why would you need that?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top