Collapse Ribbon programatically

Jul 21, 2010 at 7:17 PM

How can I collapse the ribbon in code? I don't want to change the Ribbon.Visibility value to Visibility.Collapsed but rather would like it to act like when you press the "Collapse" button on the ribbon.

Jul 21, 2010 at 7:45 PM
Use Ribbon.IsMinimized property. Daniel
Jul 21, 2010 at 9:07 PM

That's what I was looking for thanks!

I found one issue with doing this though. When I set the IsMinimized property to false all of the buttons are hidden. Do you know the cause of this?


		private void Ribbon_SelectedTabChanged(object sender, EventArgs e)
			string s = this.Ribbon.SelectedTabItem.Header.ToString();
			if (string.Equals(this.Ribbon.SelectedTabItem.Header, "Tab2"))
				this.Ribbon.IsMinimized = true;
			if (string.Equals(this.Ribbon.SelectedTabItem.Header, "Tab1"))
				this.Ribbon.IsMinimized = false;

Jul 27, 2010 at 10:41 AM

Hiding groups and buttons on a Tab that is minimized is the default behavior of the Fluent Ribbon in Office Applications.  When a Ribbon Tab is minimized - only the tabs are visible.  In the minimized state, when a particular Tab recieves focus, it will expand, hovering over the application main window showing the available groups and buttons on the active tab.  When the Tab (or ribbon) loses focus, the ribbon groups and buttons are minimized leaving only the Tab visible.  Many users work in Office applications with the Ribbon minimized to maximize the applications main window working space.  Hope this helps.  Kristi