Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6246703
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:44:23+00:00 2026-05-24T12:44:23+00:00

I am trying to come up with a Menu and Context menu architecture similar

  • 0

I am trying to come up with a Menu and Context menu architecture similar to what Visual Studio 2010 offers so that I could extend my current Menu with additional subitems provided by extensions. I am using MEF (Managed Extensibility Framework).
As an example, the Resharper extension adds menu items and context menu items in any possible position (top, middle or bottom of the context menu or a menu item)
How could one go to provide such a functionality? Do I have to index every single menu item of the shell and have the extension refer to the index to position its on subitems?
I hope that my question is clear enough. If not I would be more than happy to add some clarification.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:44:24+00:00Added an answer on May 24, 2026 at 12:44 pm

    I’m not sure there’s a single best way to do this. But here are some ideas to consider:

    A fairly simple solution is to use a single contract (ie IMenuIten) and use metadata to control what menu the command appears in and in what position. One way to do this is to have an “index”, although it should probably be a double and used to sort the items in a menu so each item doesn’t need to know its absolute position in the menu. Another way is to have metadata on the menu items that gives a list of other items that should be before and after the current item. Then you can do a topological sort on the menu items to get an order to display them in.

    Depending on how complex/dynamic your menu behavior needs to be, you may find that you can’t express it well using export metadata. In this case you might move the functionality to the contract itself- ie adding properties or methods on your IMenuItem contract. That way you can run code to calculate the values you need.

    Another solution is not to export menu items directly at all. Instead, you can have a menu service that is imported by a component. The service would have a Register method which would add a menu item to a menu. In my opinion this makes adding menu items quite a bit more cumbersome so I wouldn’t recommend it unless there’s a reason you need it. It might be appropriate if the available menu items should change based on the current context of the application. Note that if you do go this way, just having a class that imports the menu service won’t cause the class to be created and composed. The class needs to export something that is imported somewhere else in the system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to come up with an algorithm that will do the following: If
I'm trying to come up with a good naming convention for boolean variables that
I'm trying to come up with a way combine two arrays that have different
I am trying to come up with a Reg Ex that finds the numbers
I'm trying to come up with an answer to two questions that didn't seem
I'm trying to come up with the largest possible group of friends that would
I am trying to use UIMenuController for a dynamical menu (titles and actions come
I'm trying to come up with a regular expression that will match open and
I'm trying to come up with a Java regex that will match a filename
I'm trying to create a 1 page website that has a menu across the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.