adding-context-menus

Add native Visual Studio context menus to custom WPF UI via VSCT and IVsUIShell.ShowContextMenu.

14|2|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/madskristensen/vs-agent-plugins --skill adding-context-menus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: adding-context-menus
Source: https://github.com/madskristensen/vs-agent-plugins/tree/main/skills/adding-context-menus
Command: npx skills add https://github.com/madskristensen/vs-agent-plugins --skill adding-context-menus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Add native-looking context menus to custom WPF UI in Visual Studio extensions (tool windows, custom tree views, list views). Use when the user wants to show a right-click context menu from their own UI that looks native to VS. Do not use regular WPF ContextMenu — it won't match VS theming or support command routing.

Core Features & Use Cases

  • Define context menus in VSCT (type="Context") and show them programmatically with IVsUIShell.ShowContextMenu.
  • Groups create separators and organize actions; use different groups and priorities to control ordering.
  • Works with VSSDK and VSIX Community Toolkit (in-process) to provide integrated command routing and theming.

Quick Start

Define VSCT context menus for your custom UI, wire right-click handlers, and call IVsUIShell.ShowContextMenu at screen coordinates.

Frequently Asked Questions about adding-context-menus

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add native Visual Studio context menus to custom WPF UI in my extension?

To add native Visual Studio context menus to custom WPF UI, define context menus in VSCT and display them programmatically using IVsUIShell.ShowContextMenu at screen coordinates. This integrates VS-style right-click options into tool windows or custom trees.

Why should I use VSCT context menus instead of regular WPF ContextMenu in Visual Studio extensions?

Regular WPF ContextMenu won't match Visual Studio theming or support integrated command routing. VSCT context menus shown via IVsUIShell.ShowContextMenu provide native VS styling, command routing, and BeforeQueryStatus updates for correct command states.

How do I organize and separate actions in a VSCT context menu for my tool window?

You organize and separate actions in a VSCT context menu using different groups and priorities. Groups create visual separators between actions, and priority values control the precise ordering of items within the Visual Studio context menu.

Does adding context menus work with the VSIX Community Toolkit in-process?

Yes, adding native VS context menus works with both VSSDK and the VSIX Community Toolkit in-process. This integration provides the necessary command routing and theming for custom UI elements inside Visual Studio extensions.

When should I not use standard WPF right-click menus in a Visual Studio tool window?

You should not use standard WPF right-click menus when building tool windows, custom tree views, or list views inside Visual Studio extensions. They fail to match VS theming and lack native command routing, requiring IVsUIShell.ShowContextMenu instead.