Export (0) Print
Expand All

CustomTaskPaneCollection Interface

Represents a collection of custom task panes in a Microsoft Office application.

Namespace:  Microsoft.Office.Tools
Assembly:  Microsoft.Office.Tools.Common (in Microsoft.Office.Tools.Common.dll)

public interface CustomTaskPaneCollection : IEnumerable<CustomTaskPane>, 
	IEnumerable, IDisposable

The CustomTaskPaneCollection type exposes the following members.

Public propertyCountGets the number of CustomTaskPane objects in the current CustomTaskPaneCollection.
Public propertyItemGets the CustomTaskPane at the specified index.

Public methodAdd(UserControl, String)Creates a new CustomTaskPane and adds it to the current CustomTaskPaneCollection. The custom task pane is based on the specified UserControl and has the specified title.
Public methodAdd(UserControl, String, Object)Creates a new CustomTaskPane and adds it to the current CustomTaskPaneCollection. The custom task pane is based on the specified UserControl, has the specified title, and is associated with the specified application window.
Public methodBeginInitInfrastructure.
Public methodDisposePerforms application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from IDisposable.)
Public methodEndInitInfrastructure.
Public methodGetEnumeratorReturns an enumerator that iterates through the collection. (Inherited from IEnumerable<CustomTaskPane>.)
Public methodRemoveRemoves the specified CustomTaskPane from the CustomTaskPaneCollection.
Public methodRemoveAtRemoves the CustomTaskPane at the specified index of the CustomTaskPaneCollection.

Use the CustomTaskPaneCollection object in an application-level add-in to add a custom task pane to an application, remove a custom task pane, or access an existing custom task pane. To access the CustomTaskPaneCollection object, use the CustomTaskPanes field of the ThisAddIn class in your add-in project. For more information, see Programming Application-Level Add-Ins.

Task panes are user interface panels that are typically docked to one side of an application window. For more information about how to create custom task panes, see Custom Task Panes.


This interface is implemented by the Visual Studio Tools for Office runtime. It is not intended to be implemented in your code. For more information, see Visual Studio Tools for Office Runtime Overview.


This documentation describes the version of this type that is used in Office projects that target the .NET Framework 4 and the .NET Framework 4.5. In projects that target the .NET Framework 3.5, this type might have different members and the code examples provided for this type might not work. For documentation about this type in projects that target the .NET Framework 3.5, see the following reference section in the Visual Studio 2008 documentation: http://go.microsoft.com/fwlink/?LinkId=160658.

The following code example demonstrates how to create a custom task pane by using the Add(UserControl, String) method. The example also uses properties of the CustomTaskPane object to modify the default appearance of the custom task pane. This code example is part of a larger example provided for CustomTaskPane.

private MyUserControl myUserControl1;
private Microsoft.Office.Tools.CustomTaskPane myCustomTaskPane;

private void ThisAddIn_Startup(object sender, System.EventArgs e)
    myUserControl1 = new MyUserControl();
    myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1,
        "New Task Pane");

    myCustomTaskPane.DockPosition =
    myCustomTaskPane.Height = 500;
    myCustomTaskPane.Width = 500;

    myCustomTaskPane.DockPosition =
    myCustomTaskPane.Width = 300;

    myCustomTaskPane.Visible = true;
    myCustomTaskPane.DockPositionChanged +=
        new EventHandler(myCustomTaskPane_DockPositionChanged);
© 2015 Microsoft