Skip to content

Commit 3905a1c

Browse files
authored
Merge pull request #2508 from damabe/1235779-2
Content updates for VS Extensibility - Part 2
2 parents 3157228 + 70b0ff3 commit 3905a1c

25 files changed

+305
-311
lines changed

docs/extensibility/adding-a-submenu-to-a-menu.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,21 @@ manager: douge
1717
ms.workload:
1818
- "vssdk"
1919
---
20-
# Adding a Submenu to a Menu
21-
This walkthrough builds on the demonstration in [Adding a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md) by showing how to add a submenu to the **TestMenu** menu.
20+
# Add a Submenu to a Menu
21+
This walkthrough builds on the demonstration in [Add a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md) by showing how to add a submenu to the **TestMenu** menu.
2222

2323
A submenu is a secondary menu that appears in another menu. A submenu can be identified by the arrow that follows its name. Clicking the name causes the submenu and its commands to be displayed.
2424

2525
This walkthrough creates a submenu in a menu on the Visual Studio menu bar and puts a new command on the submenu. The walkthrough also implements the new command.
2626

2727
## Prerequisites
28-
Starting in Visual Studio 2015, you do not install the Visual Studio SDK from the download center. It is included as an optional feature in Visual Studio setup. You can also install the VS SDK later on. For more information, see [Installing the Visual Studio SDK](../extensibility/installing-the-visual-studio-sdk.md).
28+
Starting in Visual Studio 2015, you do not install the Visual Studio SDK from the download center. It is included as an optional feature in Visual Studio setup. You can also install the VS SDK later on. For more information, see [Install the Visual Studio SDK](../extensibility/installing-the-visual-studio-sdk.md).
2929

30-
## Adding a Submenu to a Menu
30+
## Add a Submenu to a Menu
3131

32-
1. Follow the steps in [Adding a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md) to create the project and menu item. The steps in this walkthrough assume that the name of the VSIX project is `TopLevelMenu`.
32+
1. Follow the steps in [Add a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md) to create the project and menu item. The steps in this walkthrough assume that the name of the VSIX project is `TopLevelMenu`.
3333

34-
2. Open TestCommandPackage.vsct. In the `<Symbols>` section, add an `<IDSymbol>` element for the submenu, one for the submenu group, and one for the command, all in the `<GuidSymbol>` node named "guidTopLevelMenuCmdSet." This is the same node that contains the `<IDSymbol>` element for the top-level menu.
34+
2. Open *TestCommandPackage.vsct*. In the `<Symbols>` section, add an `<IDSymbol>` element for the submenu, one for the submenu group, and one for the command, all in the `<GuidSymbol>` node named "guidTopLevelMenuCmdSet." This is the same node that contains the `<IDSymbol>` element for the top-level menu.
3535

3636
```xml
3737
<IDSymbol name="SubMenu" value="0x1100"/>
@@ -51,7 +51,7 @@ This walkthrough builds on the demonstration in [Adding a Menu to the Visual Stu
5151
</Menu>
5252
```
5353

54-
The GUID/ID pair of the parent specifies the menu group that was generated in [Adding a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md), and is a child of the top-level menu.
54+
The GUID/ID pair of the parent specifies the menu group that was generated in [Add a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md), and is a child of the top-level menu.
5555

5656
4. Add the menu group defined in step 2 to the `<Groups>` section and make it a child of the submenu.
5757

@@ -78,9 +78,9 @@ This walkthrough builds on the demonstration in [Adding a Menu to the Visual Stu
7878

7979
7. Click **TestMenu** to see a new submenu named **Sub Menu**. Click **Sub Menu** to open the submenu and see a new command, **Test Sub Command**. Notice that clicking **Test Sub Command** does nothing.
8080

81-
## Adding a Command
81+
## Add a Command
8282

83-
1. Open TestCommand.cs and add the following command ID after the existing command ID.
83+
1. Open *TestCommand.cs* and add the following command ID after the existing command ID.
8484

8585
```csharp
8686
public const int cmdidTestSubCmd = 0x105;
@@ -121,7 +121,7 @@ This walkthrough builds on the demonstration in [Adding a Menu to the Visual Stu
121121
}
122122
```
123123

124-
3. Add SubItemCallback(). This is the method that is called when the new command in the submenu is clicked.
124+
3. Add `SubItemCallback()`. This is the method that is called when the new command in the submenu is clicked.
125125

126126
```csharp
127127
private void SubItemCallback(object sender, EventArgs e)
@@ -151,6 +151,6 @@ This walkthrough builds on the demonstration in [Adding a Menu to the Visual Stu
151151

152152
5. On the **TestMenu** menu, click **Sub Menu** and then click **Test Sub Command**. A message box should appear and display the text, "Test Command Inside TestCommand.SubItemCallback()".
153153

154-
## See Also
155-
[Adding a Menu to the Visual Studio Menu Bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md)
156-
[Commands, Menus, and Toolbars](../extensibility/internals/commands-menus-and-toolbars.md)
154+
## See also
155+
[Add a menu to the Visual Studio menu bar](../extensibility/adding-a-menu-to-the-visual-studio-menu-bar.md)
156+
[Commands, menus, and toolbars](../extensibility/internals/commands-menus-and-toolbars.md)

docs/extensibility/adding-a-tool-window.md

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ manager: douge
1515
ms.workload:
1616
- "vssdk"
1717
---
18-
# Adding a Tool Window
18+
# Add a tool window
1919
In this walkthrough you learn how to create a tool window and integrate it into Visual Studio in the following ways:
2020

2121
- Add a control to the tool window.
@@ -29,25 +29,25 @@ In this walkthrough you learn how to create a tool window and integrate it into
2929
- Set the default position for the tool window.
3030

3131
## Prerequisites
32-
Starting in Visual Studio 2015, you do not install the Visual Studio SDK from the download center. It is included as an optional feature in Visual Studio setup. You can also install the VS SDK later on. For more information, see [Installing the Visual Studio SDK](../extensibility/installing-the-visual-studio-sdk.md).
32+
Starting in Visual Studio 2015, you do not install the Visual Studio SDK from the download center. It is included as an optional feature in Visual Studio setup. You can also install the VS SDK later on. For more information, see [Install the Visual Studio SDK](../extensibility/installing-the-visual-studio-sdk.md).
3333

34-
## Creating a Tool Window
34+
## Create a tool window
3535

3636
1. Create a project named **FirstToolWin** using the VSIX template, and add a custom tool window item template named **FirstToolWindow**.
3737

3838
> [!NOTE]
39-
> For more information about creating an extension with a tool window, see [Creating an Extension with a Tool Window](../extensibility/creating-an-extension-with-a-tool-window.md).
39+
> For more information about creating an extension with a tool window, see [Create an extension with a tool window](../extensibility/creating-an-extension-with-a-tool-window.md).
4040
41-
## Add a Control to the Tool Window
41+
## Add a control to the tool window
4242

43-
1. Remove the default control. Open FirstToolWindowControl.xaml and delete the **Click Me!** button.
43+
1. Remove the default control. Open *FirstToolWindowControl.xaml* and delete the **Click Me!** button.
4444

4545
2. In the **Toolbox**, expand the **All WPF Controls** section and drag the **Media Element** control to the **FirstToolWindowControl** form. Select the control, and in the **Properties** window, name this element **mediaElement1**.
4646

47-
## Add a Toolbar to the Tool Window
47+
## Add a toolbar to the tool window
4848
By adding a toolbar in the following manner, you guarantee that its gradients and colors are consistent with the rest of the IDE.
4949

50-
1. In **Solution Explorer**, open FirstToolWindowPackage.vsct. The .vsct file defines the graphical user interface (GUI) elements in your tool window by using XML.
50+
1. In **Solution Explorer**, open *FirstToolWindowPackage.vsct*. The *.vsct* file defines the graphical user interface (GUI) elements in your tool window by using XML.
5151

5252
2. In the `<Symbols>` section, find the `<GuidSymbol>` node whose `name` attribute is `guidFirstToolWindowPackageCmdSet`. Add the following two `<IDSymbol>` elements to the list of `<IDSymbol>` elements in this node to define a toolbar and a toolbar group.
5353

@@ -86,7 +86,7 @@ In this walkthrough you learn how to create a tool window and integrate it into
8686

8787
By setting the parent GUID and ID to the GUID and ID of the toolbar, you add the group to the toolbar.
8888

89-
## Add a Command to the Toolbar
89+
## Add a command to the toolbar
9090
Add a command to the toolbar, which is displayed as a button.
9191

9292
1. In the `<Symbols>` section, declare the following IDSymbol elements just after the toolbar and toolbar group declarations.
@@ -96,7 +96,7 @@ In this walkthrough you learn how to create a tool window and integrate it into
9696
<IDSymbol name="cmdidWindowsMediaOpen" value="0x132" />
9797
```
9898

99-
2. Add a Button element inside the `<Buttons>` section. This element will appear on the toolbar in the tool window, with a Search (magnifying glass) icon.
99+
2. Add a Button element inside the `<Buttons>` section. This element will appear on the toolbar in the tool window, with a **Search** (magnifying glass) icon.
100100

101101
```xml
102102
<Button guid="guidFirstToolWindowPackageCmdSet" id="cmdidWindowsMediaOpen" priority="0x0101" type="Button">
@@ -109,7 +109,7 @@ In this walkthrough you learn how to create a tool window and integrate it into
109109
</Button>
110110
```
111111

112-
3. Open FirstToolWindowCommand.cs and add the following lines in the class just after the existing fields.
112+
3. Open *FirstToolWindowCommand.cs* and add the following lines in the class just after the existing fields.
113113

114114
```csharp
115115
public const string guidFirstToolWindowPackageCmdSet = "00000000-0000-0000-0000-0000"; // get the GUID from the .vsct file
@@ -120,10 +120,10 @@ In this walkthrough you learn how to create a tool window and integrate it into
120120

121121
Doing this makes your commands available in code.
122122

123-
## Add a MediaPlayer Property to FirstToolWindowControl
123+
## Add a MediaPlayer property to FirstToolWindowControl
124124
From the event handlers for the toolbar controls, your code must be able to access the Media Player control, which is a child of the FirstToolWindowControl class.
125125

126-
In **Solution Explorer**, right-click FirstToolWindowControl.xaml, click **View Code**, and add the following code to the FirstToolWindowControl Class.
126+
In **Solution Explorer**, right-click *FirstToolWindowControl.xaml*, click **View Code**, and add the following code to the FirstToolWindowControl class.
127127

128128
```csharp
129129
public System.Windows.Controls.MediaElement MediaPlayer
@@ -132,10 +132,10 @@ public System.Windows.Controls.MediaElement MediaPlayer
132132
}
133133
```
134134

135-
## Instantiate the Tool Window and Toolbar
135+
## Instantiate the tool window and toolbar
136136
Add a toolbar and a menu command that invokes the **Open File** dialog and plays the selected media file.
137137

138-
1. Open FirstToolWindow.cs and add the following `using` statements.
138+
1. Open *FirstToolWindow.cs* and add the following `using` statements.
139139

140140
```csharp
141141
using System.ComponentModel.Design;
@@ -198,7 +198,7 @@ public System.Windows.Controls.MediaElement MediaPlayer
198198
mcs.AddCommand(menuItem);
199199
```
200200

201-
#### To implement a menu command in the tool window
201+
### To implement a menu command in the tool window
202202

203203
1. In the FirstToolWindowCommand class, add a ButtonHandler method that invokes the **Open File** dialog. When a file has been selected, it plays the media file.
204204

@@ -245,10 +245,10 @@ public System.Windows.Controls.MediaElement MediaPlayer
245245
}
246246
```
247247

248-
## Set the Default Position for the Tool Window
249-
Next, specify a default location in the IDE for the tool window. Configuration information for the tool window is in the FirstToolWindowPackage.cs file.
248+
## Set the default position for the tool window
249+
Next, specify a default location in the IDE for the tool window. Configuration information for the tool window is in the *FirstToolWindowPackage.cs* file.
250250

251-
1. In FirstToolWindowPackage.cs, find the <xref:Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute> attribute on the `FirstToolWindowPackage` class, which passes the FirstToolWindow type to the constructor. To specify a default position, you must add more parameters to the constructor following example.
251+
1. In *FirstToolWindowPackage.cs*, find the <xref:Microsoft.VisualStudio.Shell.ProvideToolWindowAttribute> attribute on the `FirstToolWindowPackage` class, which passes the FirstToolWindow type to the constructor. To specify a default position, you must add more parameters to the constructor following example.
252252

253253
```csharp
254254
[ProvideToolWindow(typeof(FirstToolWindow),
@@ -261,17 +261,17 @@ public System.Windows.Controls.MediaElement MediaPlayer
261261
> [!NOTE]
262262
> For more information about the types of windows in the IDE, see <xref:EnvDTE.vsWindowType>.
263263

264-
## Testing the Tool Window
264+
## Test the tool window
265265

266-
1. Press F5 to open a new instance of the Visual Studio experimental build.
266+
1. Press **F5** to open a new instance of the Visual Studio experimental build.
267267

268268
2. On the **View** menu, point to **Other Windows** and then click **First Tool Window**.
269269

270270
The media player tool window should open in the same position as **Solution Explorer**. If it still appears in the same position as before, reset the window layout (**Window / Reset Window Layout**).
271271

272-
3. Click the button (it has the Search icon) in the tool window. Select a supported sound or video file, for example, C:\windows\media\chimes.wav, then press **Open**.
272+
3. Click the button (it has the **Search** icon) in the tool window. Select a supported sound or video file, for example, *C:\windows\media\chimes.wav*, then press **Open**.
273273

274274
You should hear the chime sound.
275275

276-
## See Also
277-
[Commands, Menus, and Toolbars](../extensibility/internals/commands-menus-and-toolbars.md)
276+
## See also
277+
[Commands, menus, and toolbars](../extensibility/internals/commands-menus-and-toolbars.md)

docs/extensibility/adding-a-toolbar-to-a-tool-window.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@ manager: douge
1515
ms.workload:
1616
- "vssdk"
1717
---
18-
# Adding a Toolbar to a Tool Window
18+
# Add a toolbar to a tool window
1919
This walkthrough shows how to add a toolbar to a tool window.
2020

2121
A toolbar is a horizontal or vertical strip that contains buttons bound to commands. The length of a toolbar in a tool window is always the same as the width or height of the tool window, depending on where the toolbar is docked.
2222

2323
Unlike toolbars in the IDE, a toolbar in a tool window must be docked and cannot be moved or customized. If the VSPackage is written in umanaged code, the toolbar can be docked on any edge.
2424

25-
For more information about how to add a toolbar, see [Adding a Toolbar](../extensibility/adding-a-toolbar.md).
25+
For more information about how to add a toolbar, see [Adding a toolbar](../extensibility/adding-a-toolbar.md).
2626

2727
## Prerequisites
2828
Starting in Visual Studio 2015, you do not install the Visual Studio SDK from the download center. It is included as an optional feature in Visual Studio setup. You can also install the VS SDK later on. For more information, see [Installing the Visual Studio SDK](../extensibility/installing-the-visual-studio-sdk.md).
2929

30-
## Creating a Toolbar for a Tool Window
30+
## Create a toolbar for a tool window
3131

32-
1. Create a VSIX project named `TWToolbar` that has both a menu command named **TWTestCommand** and a tool window named **TestToolWindow**. For more information, see [Creating an Extension with a Menu Command](../extensibility/creating-an-extension-with-a-menu-command.md) and [Creating an Extension with a Tool Window](../extensibility/creating-an-extension-with-a-tool-window.md). You need to add the command item template before adding the tool window template.
32+
1. Create a VSIX project named `TWToolbar` that has both a menu command named **TWTestCommand** and a tool window named **TestToolWindow**. For more information, see [Create an extension with a menu command](../extensibility/creating-an-extension-with-a-menu-command.md) and [Create an extension with a tool window](../extensibility/creating-an-extension-with-a-tool-window.md). You need to add the command item template before adding the tool window template.
3333

34-
2. In TWTestCommandPackage.vsct, look for the Symbols section. In the GuidSymbol node named guidTWTestCommandPackageCmdSet declare a toolbar and a toolbar group, as follows.
34+
2. In *TWTestCommandPackage.vsct*, look for the Symbols section. In the GuidSymbol node named guidTWTestCommandPackageCmdSet declare a toolbar and a toolbar group, as follows.
3535

3636
```xml
3737
<IDSymbol name="TWToolbar" value="0x1000" />
@@ -52,7 +52,7 @@ This walkthrough shows how to add a toolbar to a tool window.
5252
</Menus>
5353
```
5454

55-
Toolbars cannot be nested like submenus. Therefore, you do not have to assign a parent. Also, you do not have to set a priority, because the user can move toolbars. Typically, initial placement of a toolbar is defined programmatically, but subsequent changes by the user are persisted.
55+
Toolbars can't be nested like submenus. Therefore, you don't have to assign a parent. Also, you don't have to set a priority, because the user can move toolbars. Typically, initial placement of a toolbar is defined programmatically, but subsequent changes by the user are persisted.
5656

5757
4. In the Groups section, define a group to contain the commands for the toolbar.
5858

@@ -79,16 +79,16 @@ This walkthrough shows how to add a toolbar to a tool window.
7979

8080
Because the new toolbar is not automatically added to the tool window, the toolbar must be added explicitly. This is discussed in the next section.
8181

82-
## Adding the Toolbar to the Tool Window
82+
## Add the toolbar to the tool window
8383

84-
1. In TWTestCommandPackageGuids.cs add the following lines.
84+
1. In *TWTestCommandPackageGuids.cs* add the following lines.
8585

8686
```csharp
8787
public const string guidTWTestCommandPackageCmdSet = "00000000-0000-0000-0000-0000"; // get the GUID from the .vsct file
8888
public const int TWToolbar = 0x1000;
8989
```
9090

91-
2. In TestToolWindow.cs add the following using statement.
91+
2. In *TestToolWindow.cs* add the following using statement.
9292

9393
```csharp
9494
using System.ComponentModel.Design;
@@ -100,7 +100,7 @@ This walkthrough shows how to add a toolbar to a tool window.
100100
this.ToolBar = new CommandID(new Guid(TWTestCommandPackageGuids.guidTWTestCommandPackageCmdSet), TWTestCommandPackageGuids.TWToolbar);
101101
```
102102

103-
## Testing the Toolbar in the Tool Window
103+
## Test the toolbar in the tool window
104104

105105
1. Build the project and start debugging. The Visual Studio experimental instance should appear.
106106

@@ -110,5 +110,5 @@ This walkthrough shows how to add a toolbar to a tool window.
110110

111111
3. On the toolbar, click the icon to display the message **TWTestCommandPackage Inside TWToolbar.TWTestCommand.MenuItemCallback()**.
112112

113-
## See Also
114-
[Adding a Toolbar](../extensibility/adding-a-toolbar.md)
113+
## See also
114+
[Add a toolbar](../extensibility/adding-a-toolbar.md)

0 commit comments

Comments
 (0)