VS2019 addin/extensions How do enable/disable menu item

327 views Asked by At

I am learning how to write VS2019 addin/extensions and searching for some good resource on specific questions like...

I am looking for some answers like,

  1. How to i enable my menu item, only when a specific type of project is open or selected in a solution. ?

  2. How do i iterate through files in a solution, How do i add files in a solution?

  3. Is there any dom object available through which i can access items i need from XAML files.

Any good easy article answering above would be helpful.

Regards

1

There are 1 answers

0
Ionut Enache On
  1. To enable/disable your menu items/commands, take a look at the BeforeQuesryStatus event. See my answer from here for more details https://stackoverflow.com/a/52059488/6775515

  2. To iterate through the file, you need to use the DTE interface. From there, you can access the solution from where you can get all the projects, all the projects file, or the selected files if this is what you want.

  3. I didn't work with XAML files in a VSIX yet, but if anybody did it, please feel free to edit this answer in order to provide better response for the community. I would be curious too :)

Here is also a playlist of new videos from Microsoft: https://www.youtube.com/watch?v=EniQmgmMb6o&list=PLReL099Y5nRdG2n1PrY_tbCsUznoYvqkS

I think you will get better responses to your questions in the future if you will post a single question/issue in one post and not a series of questions.