The TaskPanes collection provides properties that are used to access a collection of task pane objects and is accessed through the TaskPanes property of the Window object .
Note | The TaskPanes collection is used only to get a count of the TaskPane objects; it cannot be used to add or remove TaskPane objects. |
The following example shows how to return a reference to the TaskPanes collection in the current form:
var objTPanes; objTPanes = XDocument.View.Window.TaskPanes;