Share via


WebPart.TitleIconImageUrl property

Gets or sets the URL to an image used to represent the Web Part in its own title bar.

Namespace:  Microsoft.SharePoint.WebPartPages
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
<WebPartStorageAttribute(Storage.None)> _
Public Overrides Property TitleIconImageUrl As String
    Get
    Set
'Usage
Dim instance As WebPart
Dim value As String

value = instance.TitleIconImageUrl

instance.TitleIconImageUrl = value
[WebPartStorageAttribute(Storage.None)]
public override string TitleIconImageUrl { get; set; }

Property value

Type: System.String
A string containing a URL. The default value is String.Empty.

Implements

IWebPart.TitleIconImageUrl

Remarks

The TitleIconImageUrl property provides a way to place a small image in a Web Part control’s title bar. For thematic consistency, application developers often make this icon similar to the image that represents the control in a catalog of Web Part controls (the image referenced in the CatalogIconImageUrl property).

You can set a value for the property programmatically in the code for the control or declaratively in the markup of a Web Part control description file (.webpart).

Examples

The following example shows how to set the TitleIconImageUrl property declaratively in a Web Part control description file. This example uses the Web Part created in Walkthrough: Creating a Basic SharePoint Web Part.

<?xml version="1.0" encoding="utf-8" ?> 
  <webParts>
     <webPart xmlns="https://schemas.microsoft.com/WebPart/v3">
       <metaData>
         <type name="MyWebParts.SimpleWebPart, Version=1.0.0.0, Culture=neutral,
         PublicKeyToken=PublicKeyToken" /> 
         <importErrorMessage>Cannot import this Web 
         Part.</importErrorMessage> 
       </metaData>
       <data>
         <properties>
           <property name="Title" type="string">My Simple Web Part</property>
           <property name="Description" type="string">A simple Web Part</property>
            <property name= "TitleIconImageUrl" type="string">/_layouts/images/mscntvwl.gif</property>
         </properties>
       </data>
     </webPart>
   </webParts>

See also

Reference

WebPart class

WebPart members

Microsoft.SharePoint.WebPartPages namespace