Articles in this section
Category / Section

How to create custom controls in MSOffice2013 and load it in WinForms RibbonControlAdv?

2 mins read

Create and load the custom controls

In RibbonControlAdv, it is possible to host customer controls as its items. Follow the given steps to load custom control in RibbonControlAdv.

1)You can host any type of control in RibbonControlAdv, hence you need to design the requirements of the customer control.

2)Load it as the child of the PopupControlContainer.

3)Display the PopupControlContainer based on selection.

C#

//Initialize the SizablePopupControlContainer that takes a child control and adds a sizable grip, so that the window can be sized.
SizablePopupControlContainer sizableContainer;
//Add the child controls to SizablePopupControlContainer
sizableContainer = new SizablePopupControlContainer(this.panel1);
//To hide the close button of the SizablePopupControlContainer.
this.sizableContainer.ShowCloseButton = false;
//To Add the Panel into SizablePopupControlContainer.
this.sizableContainer.Controls.Add(this.panel1);
this.sizableContainer.ShowPopup(new Point(Cursor.Position.X - 100, Cursor.Position.Y + 45));    

VB

'Initialize the SizablePopupControlContainer that takes a child control and adds a sizable grip, so that the window can be sized.
Private sizableContainer As SizablePopupControlContainer
'Add the child controls to SizablePopupControlContainer.
sizableContainer = New SizablePopupControlContainer(Me.panel1)
'To hide the close button of the SizablePopupControlContainer.
Me.sizableContainer.ShowCloseButton = False
'To Add the Panel into SizablePopupControlContainer.
Me.sizableContainer.Controls.Add(Me.panel1) 
'Displays the popup control with specified location.
Me.sizableContainer.ShowPopup(New Point(Cursor.Position.X - 100, Cursor.Position.Y + 45))

The following image shows the Custom DropDown with resizable functionality.

Show the custom dropdown

Figure 1: Output

Note:

The ShowGripper property of the SizablePopupControlContainer is set as True. Hence, it is needed to disable the ShowGripper property to hide the gripper style.

Samples:

C#: https://www.syncfusion.com/downloads/support/directtrac/139141/RibbonGallery431563981.zip

VB: https://www.syncfusion.com/downloads/support/directtrac/139141/RibbonGallery_VB730974864.zip

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied