Context menus are typically invoked when the user right clicks a certain area or element (or presses Shift + F10 or a designated key on some keyboards). They are called "context" menus because different situations may call for different menus, or at least different available options. The
ContextMenu class (a derivative of
MenuBase) can host a bunch of
MenuItem controls (and separators). Let's see how this works.
CH04.Lists project from the Creating a list of items recipe.
We'll continue with the
CH04.Lists project and enhance it to make a context menu available:
ContextMenuproperty of the
ContextMenuobject with some