I have a tray application with a contextMenuStrip, and I want to add a 'radio checkList' to it, just like the Windows 10 volume settings can (See screenshot below)

Windows 10 volume mixer

The list should appear on hover, and show all the options, and user can select only one (radioButton like)

I Already have the entire application and system tray icon working, just need this option for a quick switch for the program configuration.

1 Answers

0
programmer444 On

You have to create a new ToolstripControlHost, add your field, cast it to toolstrip item and add it to your contextmenustrip.

Example:

System.Windows.Forms.RadioButton a = new RadioButton();

ToolStripControlHost host = new ToolStripControlHost(a);

 this.contextMenuStrip1.Items.Add((ToolStripItem)host);

 System.Windows.Forms.RadioButton a2 = new RadioButton();

 ToolStripControlHost host2 = new ToolStripControlHost(a2);

 this.contextMenuStrip1.Items.Add((ToolStripItem)host2);

 this.contextMenuStrip1.Show(new Point(e.X, e.Y));

Reading here: https://social.msdn.microsoft.com/Forums/en-US/5ce069a4-b11c-4186-a7ae-3620d0a14dd6/contextmenustrip-check-boxes-to-work-like-radiobuttons?forum=winforms