September 2012
Intermediate to advanced
464 pages
10h 55m
English
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.
Open the 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:
MainWindow.xaml.ContextMenu property of the ListBox to a ContextMenu object with some MenuItem instances:<ListBox.ContextMenu> ...