0

How can I modify the items that appear in the solution explorer "Add" context sub menu? Currently there is New Item, Existing Item, New Folder, then Windows Form, User Control, then Component and Class. I especially want to get rid of the 2 WinForms items and replace them with their WPF counterparts. How do I do that in the easiest way?

Hackworth
  • 1,069
  • 2
  • 9
  • 23

1 Answers1

0

You can modify the Add sub menu you get when you right click on a project item from the Tools->Customize... menu:

  1. click on the Commands tab
  2. pick the 'Context Menu' radio button
  3. select Project and Solution Context Menus | Project | Add from the combo box

From here you can modify the context menu.

This is not, however, what you want to do in your particular case.

The WPF commands you want are already in that context menu; you'll see WPF commands like "Add Window" and "Add Page" already present in the Customize dialog if you go through the instructions above. The reason that you don't see them in the actual context menu is because Visual Studio is trying to be smart and it thinks that you're developing a WinForms app and not a WPF app. If it thought this was a WPF app, you wouldn't see the windows forms option (and the user control option would create a WPF user control).

In order to correct visual studio's incorrect assumption, you could make a new project - make sure you pick that you want a WPF app - and add all of your existing files, or you can edit your .csproj file: see my answer to this SO question.

Community
  • 1
  • 1
othp
  • 321
  • 3
  • 6