tags:

views:

1324

answers:

4

Inside my control, I have:

ContextMenu = new ContextMenu();
ContextMenu.MenuItems.Add(new MenuItem("&Add Item", onAddSpeaker));
ContextMenu.MenuItems.Add(new MenuItem("&Edit Item", onEditSpeaker));
ContextMenu.MenuItems.Add(new MenuItem("&Delete Item", onDeleteSpeaker));
ContextMenu.MenuItems.Add( ??? );
ContextMenu.MenuItems.Add(new MenuItem("Cancel"));

What do I put to make a menu separator ?

+16  A: 

I believe it's just a dash:

ContextMenu.MenuItems.Add("-");
rwmnau
Great, thanks for the quick answer!
Adam Pierce
This is one of many poorly documented items in Windows. I needed to do this a few months ago. I remembered that I could do it in Win32, but couldn't remember the syntax. I ended up pulling up some old VC++ 6 files to find it. By the way, I still occasionally refer to "The Petzold Book" for some things. Wow, I'm feeling old...
Brad Bruce
+2  A: 

use hyphen "-" as text

Aziz
+1  A: 

Set the text property to a hyphen.

shahkalpesh
+3  A: 

In WPF:

ContextMenu.MenuItems.Add(new Separator());
al2suarez