This project is read-only.
The RibbonHost Control is a special Ribbon control that allows a custom (non-Ribbon) control to be displayed on the Ribbon. This allow the user to extend the functionality of the Ribbon.

A RibbonHost contain may be inserted anywhere a RibbonItem can, though depending on the type of control, it may not display correctly.

To add a custom control, for example on the Ribbon directly:
  1. Add your custom control (from the toolbox) to somewhere on your form. Don't worry, it will disappear at runtime.
  2. Insert a RibbonHost control onto a Panel as you would a RibbonButton.
  3. In the properties of the RibbonHost, change the HostedControl property to the name of your custom control:
  4. Run your project and confirm that the control appears in the correct location.
  5. Hook into the events of your custom control as if it were not hosted on the RibbonHost.

There is one RibbonHost event that is fired when the Ribbon changes size. The event details the new SizeMode of the your control (Large, Compact, etc.). The Ribbon does not know how you want to handle the change, if at all, so you must provide the programming for such changes. For example, you may want your control to be 100 pixels wide in Large mode, 50 pixels wide in Medium mode and invisible in Compact and Small mode.

Below is an example of a split button dropdown containing two buttons and a RibbonHost control hosting a ColorPicker control:

2015-01-13_20-41-08.png

Below is an example of a MonthCalendar control in a ComboBox using a RibbonHost located in the ComboBox list:

2015-01-13_20-47-29.png

Below is an example of a Progress Bar control on the Ribbon:

2015-01-13_20-53-32.png

Hosting Error
Note that as error ("null reference error with hosted object" or similar) has been seen caused by the order of controls in the designer. The RibbonHost HostedControl is set to an object that has not yet been defined. In this case, the current work around is to set the HostedControl on form load instead of in the designer.

Last edited Mar 17, 2015 at 3:22 PM by Stumpii, version 6

Comments

deafie Mar 31, 2015 at 1:54 PM 
Did you notice the Hosting Error and implemented the workaround?

akshykhade Mar 16, 2015 at 10:31 AM 
I am trying to host List box, But after some time or some runs of application it gives null exception error even that control exits in this form. so please tell me what should i do?