-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Environment
Edition - Windows 11 Enterprise
Version - 23H2
OS build - 22631.3737
Visual Studio version - 17.12.2
.NET version
NET90
Did this work in a previous version of Visual Studio and/or previous .NET release?
No
Issue description
Requirement:
I need to create a custom dropdown menu as a UserControl. The goal is to use this custom menu in various ToolStrip controls across different TabPages within a TabControl.
Issue Faced:
While implementing this feature, I encountered two critical issues:
1.Menu Not Added to ToolStrip:
Despite correctly adding the custom menu UserControl to the ToolStrip via ToolStripControlHost, the menu does not appear as expected. The ToolStripControlHost is not rendering the menu inside the ToolStrip control.
2.Application Crash:
In addition to the above, when trying to add the custom UserControl to the ToolStrip, the application crashes. This occurs specifically when using ToolStripControlHost to host the UserControl.
Steps to reproduce
1.Create a new Windows Forms project.
2.Add a TabControl with multiple TabPages in the form
3.Create a UserControl (Menu) that contains a ToolStrip with a ToolStripDropDownButton and a few ToolStripMenuItems.
4.In the Form1 designer, use ToolStripControlHost to host the Menu UserControl and add it to the ToolStrip in TabPage1.
5.Run the application.
6.The menu should appear in the ToolStrip, but an application crash occurs when trying to close and reopen the design files.
Recording 2025-03-13 165846.zip
Diagnostics