Filter the AddItem dialog box for nested projects

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

When you display an AddItem dialog box for a nested project, the parent project can control what items are displayed in the dialog box.

The IVsFilterAddProjectItemDlg2 interface lets you filter the nodes that will be in an AddItem dialog box. When the child project displays the AddItem dialog box, the parent can implement the IVsFilterAddProjectItemDlg interface and filter items that would otherwise be displayed in the child's project.

When projects are grouped by function under specific parent projects, you can implement IVsFilterAddProjectItemDlg when the user selects Add Project Item on the shortcut menu in a nested project. Implementing IvsFilterAddProjectItemDlg displays only project items or files specific to that group. Project items for other groups are filtered out of the dialog box, even if they are stored in the same directory.

When a user opens the AddItem dialog box for the child, the parent project's implementation of the IVsFilterAddProjectItemDlg interface is called.

The IVsFilterAddProjectItemDlg interface can also implement filtering by category. For more information, see Add items to the Add New Item dialog box and Register project and item templates.

See also