WPF Ribbon Deploys and Expands Software

The latest WPF ribbon libraries (October 2010) have a menu item that allows you to minimize / maximize (or collapse / maximize, if you want) the ribbon control.

Does anyone know if there is a way to connect to events that control this behavior so that it can be controlled programmatically from a separate interface? Or, even better, is there a way to make the minimize / expand button appear on the ribbon, as Office 2010 applications do?

+6
c # wpf ribbon
source share
3 answers

You can use the boolean property IsMinimized in the Ribbon class to show / hide the ribbon. This is a dependency property, so you can bind to its value to support the described scenarios.

As far as I know, the default template does not have a show / hide button, such as Office, but you do not need to modify the template too much (using Blend) to add it.

+6
source share

If you need to know when the panel is minimized (this happens when you double-click the tab title), you can connect to the IsMinimizedChanged event, but er .. it is missing. I hope this is DependencyProperty , so you can successfully switch to any DependencyProperty change as follows:

DependencyPropertyDescriptor.FromProperty(Ribbon.IsMinimizedProperty, typeof(Ribbon)) .AddValueChanged(ribbon, (o, args) => /* your code here */);

What I wanted to do (and therefore got here) is to prevent it from being minimized by double-clicking on the header, so I ended up using this code:

DependencyPropertyDescriptor.FromProperty(Ribbon.IsMinimizedProperty, typeof(Ribbon)) .AddValueChanged(ribbon, (o, args) => ribbon.IsMinimized = false);

Not so fantastic, but it does its job.

+1
source share

Add a toggle button (a simple button and set its contents to v or ^ depending on the requested operation), and then you can use the ContentControl button in the pressed button to fulfill your requirement:

  ContentControl contentControl = FindVisualChildataBankyName<ContentControl>(rbnName, "mainItemsPresenterHost"); contentControl.Visibility = System.Windows.Visibility.Collapsed; 

Use contentControl.Visibility = System.Windows.Visibility.Visible; to maximize the tape

0
source share

All Articles