10

i know how to create a left-click context menu for a button, but I am not too sure how to do it for a right click? (i.e. how to specify that the context menu should appear on a right-click, not a left click).

Many thanks.

1
  • 1
    are you sure you don't have the question reversed? contextmenu is triggered by a right-click by default, to trigger on a left-click is what takes extra work (don't know why you'd want that on a button though?) Commented Jul 21, 2011 at 20:15

1 Answer 1

27

Here is a sample:

<Button Content="button" Name="btn" Width="100">
    <Button.ContextMenu>
        <ContextMenu>
            <MenuItem Header="Cut"/>
            <MenuItem Header="Copy"/>
            <MenuItem Header="Paste"/>
        </ContextMenu>
    </Button.ContextMenu>
</Button>

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.