Articles in this section
Category / Section

How to load custom controls in the ToolStripDropDownButton DropDown?

1 min read

Load custom controls

You can load custom WinForms Ribbon control as dropdown of the ToolStripDropDownButton by using the DropDown property in the ToolStripDropDownButton. This property helps you to assign the custom dropdown to dropdown of the ToolStripDropDownButton.

C#

//Assigns the custom DropDown to the ToolStripDropDownbutton
this.toolStripDropDownButton1.DropDown = new CustomDropDown(this.menuStrip1);
//Creates the CustomDropDown class
public class CustomDropDown : ToolStripDropDown
{
    public CustomDropDown(MenuStrip menuStrip)
    {
        this.Items.Add(new ToolStripControlHost(menuStrip));
    }
}

VB

'Assigns the custom DropDown to the ToolStripDropDownbutton
Me.toolStripDropDownButton1.DropDown = New CustomDropDown(Me.menuStrip1)
'Creates the CustomDropDown class
Public Class CustomDropDown
     Inherits ToolStripDropDown
     Public Sub New(ByVal menuStrip As MenuStrip)
         Me.Items.Add(New ToolStripControlHost(menuStrip))
     End Sub
End Class

 

Custom Dropdown loaded in the ToolStripDropDown button in WinForms Ribbon Control

Figure 1: Custom DropDown loaded in the ToolStripDropDown button.

Samples:

C#: CustomDropDown_C#

VB: CustomDropDown_VB

 

Conclusion

I hope you enjoyed learning about how to load custom controls in the ToolStripDropDownButton DropDown.

You can refer to our WinForms Ribbon Control’s feature tour page to know about its other groundbreaking feature representations. You can also explore our WinForms Ribbon Control documentation to understand how to present and manipulate data. 

For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our WinForms Ribbon Control and other WinForms components.

If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!

 

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