- Service Task Panes
- Panes in Windows Terminal
- Creating a new pane
- Using the keyboard
- Using the new tab button and dropdown menu
- Switching between panes
- Resizing a pane
- Closing a pane
- Customizing panes using key bindings
- Duplicating a pane
- Zooming a pane
- Marking a pane as read-only
- New terminal arguments
- Custom task panes
- Benefits of custom task panes
- Familiar user interface
- Windows forms support
- Create a custom task pane
- Create the user interface
- Instantiate the custom task pane
- Control the task pane in multiple windows
- Access the application from the Task Pane
- Manage the user interface of the Task Pane
- Make the custom Task Pane visible
- Modify the appearance of the task pane
- Program custom task pane events
- Clean up resources used by the task pane
- Manage custom task panes in multiple application windows
- Outlook
Service Task Panes
In Windows Media Player 10, online store providers can configure Windows Media Player to display as many as three task panes, called service task panes. Each service task pane is represented by a customizable button that Windows Media Player displays on the right side of the Features taskbar.
Each service task pane hosts a webpage that is the user interface for a particular online store feature.The appearance of the service task panes is defined by the ServiceInfo XML document. In this document, the service task panes are represented by three elements: ServiceTask1, ServiceTask2, and ServiceTask3. These service task panes are intended to provide the following:
- A music service.
- A video service.
- A radio service.
You can position these features in Windows Media Player in any order you like, but ServiceTask1 must be the primary task pane for engaging in commercial activity.
The webpage hosted in each service task pane has access to the External object. This object provides methods, properties, and an event that provide special functionality for webpages in Windows Media Player. For instance, you can use the event and properties from External to make the appearance of your webpage match the color scheme that the user has chosen for Windows Media Player.
In Windows Media Player 11, there are no service task panes. Instead, there is a single Online Stores tab, which hosts the main webpage for the active online store. In the ServiceInfo document, the Online Stores tab is represented by the ServiceTask1 element; the ServiceTask2 and ServiceTask3 elements are ignored.
Panes in Windows Terminal
Panes give you the ability to run multiple command-line applications next to each other within the same tab. This minimizes the need to switch between tabs and lets you see multiple prompts at once.
Creating a new pane
Using the keyboard
You can either create a new vertical or horizontal pane in Windows Terminal. Splitting vertically will open a new pane to the right of the focused pane and splitting horizontally will open a new pane below the focused pane. To create a new vertical pane of your default profile, you can press the Alt + Shift + = key combination. For a horizontal pane of your default profile, you can use Alt + Shift + — .
Configuration: Raspberry Ubuntu
If you would like to change these key bindings, you can create new ones using the splitPane action and vertical , horizontal , or auto values for the split property in your profiles.json file. The auto method will choose the direction that gives you the squarest panes. To learn more about key bindings, visit the Actions page.
Using the new tab button and dropdown menu
If you’d like to open a new pane of your default profile, you can hold the alt key and click the new tab button. If you’d like to open a new pane through the dropdown menu, you can hold alt and click on your desired profile. Both of these options will auto split the active window or pane into a new pane of the selected profile. The auto split mode splits in the direction that has the longest edge to create a pane.
Switching between panes
The terminal allows you to navigate between panes by using the keyboard. If you hold the Alt key, you can use your arrow keys to move your focus between panes. You can identify which pane is in focus by the accent color border surrounding it. Note that this accent color is set in your Windows color settings.
You can customize this by adding key bindings for the moveFocus command and setting the direction to either down , left , right or up .
Resizing a pane
You can adjust the size of your panes by holding Alt + Shift and using your arrow keys to resize the focused pane.
To customize this key binding, you can add new ones using the resizePane action and setting the direction to either down , left , right , or up .
Closing a pane
You can close the focused pane by typing Ctrl + Shift + W . If you only have one pane, Ctrl + Shift + W will close the tab. As always, closing the last tab will close the window.
You can change which keys close the pane by adding a key binding that uses the closePane command.
Customizing panes using key bindings
You can customize what opens inside a new pane depending on your custom key bindings.
Duplicating a pane
The terminal allows you to duplicate the focused pane’s profile into another pane.
This can be done by adding the splitMode property with duplicate as the value to a splitPane key binding.
Zooming a pane
You can zoom the focused pane to fill the entire contents of the window.
This can be done by using the togglePaneZoom command.
Marking a pane as read-only
You can mark a pane as read-only, which will prevent input from going into the text buffer. If you attempt to close or input text into a read-only pane, the terminal will display a popup warning instead.
You can toggle read-only mode on a pane with the toggleReadOnlyMode command.
New terminal arguments
When opening a new pane or tab with a key binding, you can specify which profile is used by including the profile’s name, guid, or index. If none are specified, the default profile is used. This can be done by adding profile or index as an argument to a splitPane or newTab key binding. Note that indexing starts at 0.
Additionally, you can override certain aspects of the profile such as the profile’s command line executable, starting directory, or tab title. This can be accomplished by adding commandline , startingDirectory , and/or tabTitle to a splitPane or newTab key binding.
Custom task panes
Task panes are user interface panels that are typically docked to one side of a window in a Microsoft Office application. Custom task panes give you a way to create your own task pane and provide users with a familiar interface to access your solution’s features. For example, the interface can contain controls that run code to modify documents or display data from a data source.
Applies to: The information in this topic applies to VSTO Add-in projects for Outlook. For more information, see Features available by Office application and project type.
A custom task pane differs from the actions pane. The actions pane is part of document-level customizations for Microsoft Office Word and Microsoft Office Excel. For more information, see Actions pane overview.
Benefits of custom task panes
Custom task panes let you integrate your features into a familiar user interface. You can create a custom task pane quickly by using Visual Studio tools.
Familiar user interface
Users of applications in the Microsoft Office system are already familiar with using task panes such as the Styles and Formatting task pane in Word. Custom task panes behave like other task panes in the Microsoft Office system. Users can dock custom task panes to different sides of the application window, or they can drag custom task panes to any location in the window. You can create a VSTO Add-in that displays multiple custom task panes at the same time, and users can control each task pane individually.
Windows forms support
The user interface of a custom task pane that you create by using the Office development tools in Visual Studio is based on Windows Forms controls. You can use the familiar Windows Forms Designer to design the user interface for a custom task pane. You can also use the data binding support in Windows Forms to bind a data source to controls on the task pane.
Create a custom task pane
You can create a basic custom task pane in two steps:
Create a user interface for your custom task pane by adding Windows Forms controls to a UserControl object.
Instantiate the custom task pane by passing the user control to the CustomTaskPaneCollection object in your VSTO Add-in. This collection returns a new CustomTaskPane object that you can use to modify the appearance of the task pane and respond to user events.
Create the user interface
All custom task panes that are created by using the Office development tools in Visual Studio contain a UserControl object. This user control provides the user interface of your custom task pane. You can create the user control at design time or at run time. If you create the user control at design time, you can use the Windows Forms Designer to construct the user interface of your task pane.
Instantiate the custom task pane
After you create a user control that contains the user interface of the custom task pane, you have to instantiate a CustomTaskPane. To do this, pass the user control to the CustomTaskPaneCollection in your VSTO Add-in by calling one of the Add methods. This collection is exposed as the CustomTaskPanes field of the ThisAddIn class. The following code example is intended to be run from the ThisAddIn class.
The Add methods return a new CustomTaskPane object. You can use this object to modify the appearance of the task pane and to respond to user events.
Control the task pane in multiple windows
Custom task panes are associated with a document frame window, which presents a view of a document or item to the user. The task pane is visible only when the associated window is visible.
To determine which window displays the custom task pane, use the appropriate Add method overload when you create the task pane:
To associate the task pane with the active window, use the Add method.
To associate the task pane with a document that is hosted by a specified window, use the Add method.
Some Office applications require explicit instructions for when to create or display your task pane when more than one window is open. This makes it important to consider where to instantiate the custom task pane in your code to ensure that the task pane appears with the appropriate documents or items in the application. For more information, see Manage custom task panes in application windows.
Access the application from the Task Pane
If you want to automate the application from the user control, you can directly access the object model by using Globals.ThisAddIn.Application in your code. The static Globals class provides access to the ThisAddIn object. The Application field of this object is the entry point into the object model of the application.
For more information about the Application field of the ThisAddIn object, see Program VSTO Add-ins. For a walkthrough that demonstrates how to automate an application from a custom task pane, see Walkthrough: Automatic an application from a custom task pane. For more information about the Globals class, see Global access to objects in Office projects.
Manage the user interface of the Task Pane
After you create the task pane, you can use properties and events of the CustomTaskPane object to control the user interface of the task pane and to respond when the user changes the task pane.
Make the custom Task Pane visible
By default, the task pane is not visible. To make the task pane visible, you must set the Visible property to true.
Users can close a task pane at any time by clicking the Close button (X) in the corner of the task pane. However, there is no default way for users to open the custom task pane again. If a user closes a custom task pane, that user cannot view the custom task pane again unless you provide a way to display it.
If you create a custom task pane in your VSTO Add-in, you should also create a UI element, such as a button, that users can click to display or hide your custom task pane. If you create a custom task pane in a Microsoft Office application that supports customizing the Ribbon, you can add a control group to the Ribbon with a button that displays or hides your custom task pane. For a walkthrough that demonstrates how to do this, see Walkthrough: Synchronize a custom task pane with a Ribbon button.
If you create a custom task pane in a Microsoft Office application that does not support customizing the Ribbon, you can add a CommandBarButton that displays or hides your custom task pane.
Modify the appearance of the task pane
You can control the size and location of a custom task pane by using properties of the CustomTaskPane object. You can make many other changes to the appearance of a custom task pane by using properties of the UserControl object that is contained in the custom task pane. For example, you can specify a background image for a custom task pane by using the BackgroundImage property of the user control.
The following table lists the changes you can make to a custom task pane by using CustomTaskPane properties.
Task | Property |
---|---|
To change the size of the task pane | Height Width |
To change the location of the task pane | DockPosition |
To hide the task pane or make it visible | Visible |
To prevent the user from changing the location of the task pane | DockPositionRestrict |
Program custom task pane events
You might want your VSTO Add-in to respond when the user modifies the custom task pane. For example, if the user changes the orientation of the pane from vertical to horizontal, you might want to reposition the controls.
The following table lists the events that you can handle to respond to changes that the user makes to the custom task pane.
Task | Event |
---|---|
To respond when the user changes the location of the task pane. | DockPositionChanged |
To respond when the user hides the task pane or makes it visible. | VisibleChanged |
Clean up resources used by the task pane
After you create a custom task pane, the CustomTaskPane object remains in memory as long as your VSTO Add-in is running. The object remains in memory even after the user clicks the Close button (X) in the corner of the task pane.
To clean up resources used by the task pane while the VSTO Add-in is still running, use the Remove or RemoveAt methods. These methods remove the specified CustomTaskPane object from the CustomTaskPanes collection, and they call the Dispose method of the object.
The Visual Studio Tools for Office runtime automatically cleans up resources used by the custom task pane when the VSTO Add-in is unloaded. Do not call the Remove or RemoveAt methods in the ThisAddIn_Shutdown event handler in your project. These methods will throw an ObjectDisposedException, because the Visual Studio Tools for Office runtime cleans up resources used by the CustomTaskPane object before ThisAddIn_Shutdown is called. For more information about ThisAddIn_Shutdown , see Events in Office projects.
Manage custom task panes in multiple application windows
When you create a custom task pane in an application that uses multiple windows to display documents and other items, you need to take extra steps to ensure that the task pane is visible when the user expects it to be.
Custom task panes in all applications are associated with a document frame window, which presents a view of a document or item to the user. The task pane is visible only when the associated window is visible. However, not all applications use document frame windows the same way.
The following application groups have different development requirements:
Outlook
When you create a custom task pane for Outlook, the custom task pane is associated with a specific Explorer or Inspector window. Explorers are windows that display the contents of a folder, and Inspectors are windows that display an item such as an email message or a task.
If you want to display a custom task pane with multiple Explorer or Inspector windows, you need to create a new instance of the custom task pane when an Explorer or Inspector window opens. To do this, handle an event that is raised when an Explorer or Inspector window is created, and then create the task pane in the event handler. You can also handle Explorer and Inspector events to hide or display task panes depending on which window is visible.
To associate the task pane with a specific Explorer or Inspector, use the Add method to create the task pane, and pass the Explorer or Inspector object to the window parameter. For more information about creating custom task panes, see Custom task panes overview.
To monitor the state of Inspector windows, you can handle the following Inspector-related events: