locked
what is difference between context menu and menu item in wpf. RRS feed

  • Question

  • Hi all i am bit confuse about menuItem and Contextmenu.Plz anybody tell what is diffidence and similarity in this???
    Friday, May 18, 2012 9:48 AM

Answers

  • Hi ,

      For Context menu , see this http://wpftutorial.net/ContextMenu.html  .   If you see the image in that link you can see that all the three of them as a whole are called context menu.

      Menu items are the individual parts present in that . 

      Observe in that link  :   A context menu contains multiple menu items.

     <ContextMenu>

             <MenuItem Command="Cut">
                     </MenuItem>
                <MenuItem Command="Copy">
                   </MenuItem>
                <MenuItem Command="Paste">
                   </MenuItem>  

      </ContextMenu>

    Hope it Helps :D

    • Proposed as answer by LeeCampbell Friday, May 18, 2012 10:25 AM
    • Marked as answer by Kee Poppy Friday, May 25, 2012 4:39 AM
    Friday, May 18, 2012 9:56 AM
  • Just to expand on Phani's comment. A Menu is normally found at the top of a window i.e. File, Edit, Help etc. menus. Each of the items in those menus are MenuItems which may have nested MenuItems.

    A Context Menu is intended to be menu that pops up when you right-click on something . The menu can have context to what was clicked hence then name. eg The Menu for a song may be Play/Skip/AddToFavourites/Share, where as a context menu for a Drive might be Format/Disconnect/Eject etc. The Menu at the top of the window would need to have global context so would potentially not offer this level of control that you would get from a ContextMenu

    Lee


    Lee Campbell http://LeeCampbell.blogspot.com

    • Marked as answer by Kee Poppy Friday, May 25, 2012 4:39 AM
    Friday, May 18, 2012 10:30 AM

All replies

  • Hi ,

      For Context menu , see this http://wpftutorial.net/ContextMenu.html  .   If you see the image in that link you can see that all the three of them as a whole are called context menu.

      Menu items are the individual parts present in that . 

      Observe in that link  :   A context menu contains multiple menu items.

     <ContextMenu>

             <MenuItem Command="Cut">
                     </MenuItem>
                <MenuItem Command="Copy">
                   </MenuItem>
                <MenuItem Command="Paste">
                   </MenuItem>  

      </ContextMenu>

    Hope it Helps :D

    • Proposed as answer by LeeCampbell Friday, May 18, 2012 10:25 AM
    • Marked as answer by Kee Poppy Friday, May 25, 2012 4:39 AM
    Friday, May 18, 2012 9:56 AM
  • Just to expand on Phani's comment. A Menu is normally found at the top of a window i.e. File, Edit, Help etc. menus. Each of the items in those menus are MenuItems which may have nested MenuItems.

    A Context Menu is intended to be menu that pops up when you right-click on something . The menu can have context to what was clicked hence then name. eg The Menu for a song may be Play/Skip/AddToFavourites/Share, where as a context menu for a Drive might be Format/Disconnect/Eject etc. The Menu at the top of the window would need to have global context so would potentially not offer this level of control that you would get from a ContextMenu

    Lee


    Lee Campbell http://LeeCampbell.blogspot.com

    • Marked as answer by Kee Poppy Friday, May 25, 2012 4:39 AM
    Friday, May 18, 2012 10:30 AM