Minimizing ribbon tab from code behind

Ribbon for WPF Forum

Posted 13 years ago by Padu Merloti
Version: 4.5.0486
Avatar
I have 3 tabs in my ribbon: File, Analysis and View.

I always want the ribbon visible (maximized), except when "File" is selected, in that case I don't want the File ribbon visible (like Office 2010).

Here's what I tried:

            <ribbon:Ribbon.Tabs>
                <!-- "File" Tab -->
                <ribbon:Tab Label="File" StaysOpenOnClick="False" >
                </ribbon:Tab>

                <!-- "Analysis" Tab -->
                <ribbon:Tab Label="Analysis" StaysOpenOnClick="True">
                </ribbon:Tab>

                <!-- "View" Tab -->
                <ribbon:Tab Label="View" StaysOpenOnClick="True">
                </ribbon:Tab>

            </ribbon:Ribbon.Tabs>
And on code behind:

        private void RibbonSelectedTabChanged(object sender, TabPropertyChangedRoutedEventArgs e)
        {
            if (tabWorkArea != null)
            {
                if (e.NewValue.Name == "ribbonFile")
                {
                    tabWorkArea.SelectedIndex = 0;
                    ribbon.IsMinimized = true;
                }
                else
                {
                    tabWorkArea.SelectedIndex = 1;
                    ribbon.IsMinimized = false;
                }
            }
        }
It partially works... when I select View or Analysis, the ribbon stays open, but when I select "File", it also stays open. It minimizes if I click anywhere outside the ribbon, but I wanted the ribbon to minimize as soon as I clicked on "File".

Comments (5)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Padu,

You might be able to handle the Ribbon.IsApplicationMenuOpenChanged event, which fires as the app menu opens/closes.


Actipro Software Support

Posted 13 years ago by Padu Merloti
Avatar
Is that something implemented in a newer version? I don't see that event. How would that event help solve my problem? Does it pass some kind of boolean reference that will avoid showing the ribbon from inside that event?
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Padu,

Oh I'm sorry, I now see you are on v4.5. That event I mentioned was added in 2010.2.

As mentioned that event fires when the application menu opens or closes so you can probably minimize the ribbon while it is open and then show it again when it is closed.


Actipro Software Support

Posted 13 years ago by Padu Merloti
Avatar
If I download and install 2010.2 will it mess with my v4.5 installation? Or... if you could quickly test if what I want is possible, that would be worthy the upgrade for us.

How far along are you guys from deploying the Office 2010 style ribbon controls?
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
I believe you can install them side-by-side.

We have full Office 2010 style implementation in the latest builds. And Backstage is done as well. Check out our blog for recent posts containing details and screenshots.


Actipro Software Support

The latest build of this product (v24.1.1) was released 21 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.