Exportieren (0) Drucken
Alle erweitern

How to: Use the ContextMenuService

This example shows how to use the ContextMenuService.

The ContextMenuService defines a number of properties and events that control the display and event operations of a ContextMenu. These properties are used by attaching them directly to the element where you want to expose the ContextMenu. These services allow a ContextMenu to appear for controls that are disabled and will not have events routed to them.

The code sample shows how to display a ContextMenu for a Button that is disabled.


<Button Height="30" Content="Disabled Button" IsEnabled="False" 
   <MenuItem Header="Item 1"/>
   <MenuItem Header="Item 2"/>     
   <MenuItem Header="Item 3"/>  

For the complete sample see ContextMenu Sample.

See Also

© 2015 Microsoft