Skip to Main Content
Essential SharePoint
book

Essential SharePoint

by Jeff Webb
May 2005
Beginner content levelBeginner
336 pages
10h 14m
English
O'Reilly Media, Inc.
Content preview from Essential SharePoint

Customizing the Property Task Pane

Members can change a web part by clicking the web part's down arrow and selecting Modify Shared Web Part or Modify Personal Web Part. That action displays the property task pane. You can customize a web part's property task pane by overriding the GetToolParts method. For example, the following code hides the built-in AllowMinimize property and expands the Custom section of the property task pane, as shown in Figure 9-14.

     Public Overrides Function GetToolParts() As ToolPart()
         Dim toolParts(2) As ToolPart
         Dim wptp As WebPartToolPart = New WebPartToolPart
         Dim custom As CustomPropertyToolPart = New CustomPropertyToolPart
         ' Hide one of the built-in properties
         wptp.Hide(wptp.Properties.AllowMinimize)
         ' Expand the Custom section.
         custom.Expand("Custom")
         toolParts(0) = wptp
         toolParts(1) = custom
         Return toolParts
     End Function

The wptp object defined in the preceding code represents the toolpart for the built-in properties—those properties inherited from the WebPart base class. The custom object represents the toolpart for all the properties you defined for the web part.

SharePoint generates the controls displayed in the CustomPropertyToolPart class, based on the data type of the custom property and whether or not it is marked as

Customizing a web part's property task pane

Figure 9-14. Customizing a web part's property task pane

Browsable in the property attributes. Table 9-4 lists the controls generated ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

SharePoint User's Guide

SharePoint User's Guide

Infusion Development Corp. (Infusion Development Corporation)
Beginning SharePoint® 2010: Building Business Solutions with SharePoint

Beginning SharePoint® 2010: Building Business Solutions with SharePoint

Amanda Perran, Shane Perran, Jennifer Mason, Laura Rogers

Publisher Resources

ISBN: 0596008805Errata Page