CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Fort Worth Texas

    Question 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 29th, 2009 at 11:12 PM. Reason: Needed to add reference to WPF

  2. #2
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004

    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:

          <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}" />
      <!-- other grid code -->

  3. #3
    Join Date
    May 1999
    Fort Worth Texas

    Exclamation Re: Popup and Right click menu

    Thank you Arjay

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.