Partager via


Tool Parts

Tool parts are used by Web Part developers to expose custom UI inside the tool pane. Tool parts are always displayed inside the tool pane and are generally used to set custom properties on Web Parts.

The Microsoft.SharePoint.WebPartPages namespace provides several classes for working with tool parts:

  • The ToolPart class is the base class for custom tool parts.
  • The WebPartToolPart class derives from the ToolPart class and represents a tool part that can be used to show and modify WebPart base class properties.
  • The CustomPropertyToolPart class derives from the ToolPart class and represents the default tool part that is displayed in the tool pane for a Web Part that implements one or more custom properties.

It is the responsibility of the Web Part developer to provide the logic for creating the list of custom tool parts that are rendered inside the tool pane. This logic resides in the GetToolParts method of the WebPart class. The GetToolParts method class returns an array that determines which tool parts are displayed in the tool pane. tool parts are rendered in the tool pane in the order listed in the array.

When creating a custom Web Part that includes custom properties requiring a custom tool part (an implementation of the ToolPart class), you must override the GetToolParts method to specify the list of custom tool parts that are rendered inside the tool pane. For more information, see Creating a Web Part with a Custom Tool Part.