-
November 30th, 2009, 12:10 AM
#1
Popup and Right click menu
I am trying to create a menu that appears when right clicking but am not sure how to implement it in WPF and have not found any online info about it. Anyone have a how to link about this? Thank you
Last edited by Jim Bassett; November 30th, 2009 at 12:12 AM.
Reason: Needed to add reference to WPF
-
November 30th, 2009, 11:32 AM
#2
Re: Popup and Right click menu
Most every control has a ContextMenu collection. All you need to do is add your menu items to it.
Here's an example of adding a context menu to a grid control:
Code:
<Grid>
<Grid.ContextMenu>
<ContextMenu>
<MenuItem Command="{x:Static uc:AppCommands.EditShift}" />
<Separator />
<MenuItem Command="{x:Static uc:AppCommands.AddShift}" />
<MenuItem Command="{x:Static uc:AppCommands.DeleteShift}" />
<Separator />
<MenuItem Command="{x:Static uc:AppCommands.MoveUpShift}" />
<MenuItem Command="{x:Static uc:AppCommands.MoveDownShift}" />
<Separator />
<MenuItem Command="{x:Static uc:AppCommands.ClearShiftEmployee}" />
<Separator />
<MenuItem Command="{x:Static uc:AppCommands.SaveTemplate}" />
</ContextMenu>
</Grid.ContextMenu>
<!-- other grid code -->
</Grid>
-
November 30th, 2009, 11:39 AM
#3
Re: Popup and Right click menu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|