When I look it up, they list it as having a .Checked
property. But both in Visual Studio and on msdn, it doesn't list any kid of Checked
property.
ContextMenuStrip menu = new ContextMenuStrip ( );
var menuItem = menu.Items.Add ( "CheckedItem" );
//menuItem.Checked?
Is there a way to do this?
ToolStripMenuItem(String, Image, ToolStripItem[]) Initializes a new instance of the ToolStripMenuItem class that displays the specified text and image and that contains the specified ToolStripItem collection.
We can add items to a MenuStrip at design-time from Properties Window by clicking on Items Collection as you can see in Figure 4. When you click on the Collections, the String Collection Editor window will pop up where you can type strings. Each line added to this collection will become a MenuStrip item.
You need to cast to ToolStripMenuItem
:
((ToolStripMenuItem)menuItem).Checked = true;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With