How to add a separator to a WinForms ContextMenu?
I believe it's just a dash:
ContextMenu.MenuItems.Add("-");
This works just as well as the dash, and i suspect the Winforms will translate the dash to a ToolStripSeparator. I for one think this solution is more obvious for anyone who has to maintain the code.
yourContextMenu.Items.Add(new ToolStripSeparator());
In WPF:
ContextMenu.MenuItems.Add(new Separator());
If you are using the Designer, place a single hyphen "-" as text the same way you would name your menu items. After hitting enter, the separator will be created.