How to: Enable a ContextMenu on a Disabled Control

This example uses the ContextMenuService to display a ContextMenu for a Button that is disabled.


<Button Height="30" Content="Disabled Button" IsEnabled="False" 
     ContextMenuService.ShowOnDisabled="True">
  <Button.ContextMenu>
    <ContextMenu>
      <MenuItem Header="Item 1"/>
      <MenuItem Header="Item 2"/>
      <MenuItem Header="Item 3"/>
    </ContextMenu>
  </Button.ContextMenu>
</Button>


Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft