Home > DeveloperSection > Forums > How to create a right-click context menu for a button in WPF?
Madam Walker
Madam Walker

Total Post:22

Points:154
Posted on    August-10-2013 5:18 AM

 WPF WPF 
Ratings:


 1 Reply(s)
 1183  View(s)
Rate this:

How to create a right-click context menu for a button in WPF?

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).

Thanks in advanced!



Pravesh Singh

Total Post:411

Points:2881
Posted on    August-10-2013 5:23 AM

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>


Don't want to miss updates? Please click the below button!

Follow MindStick