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)

public override string TitleIconImageUrl { get; set; }

Property value

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



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).

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" ?> 
     <webPart xmlns="http://schemas.microsoft.com/WebPart/v3">
         <type name="MyWebParts.SimpleWebPart, Version=, Culture=neutral,
         PublicKeyToken=PublicKeyToken" /> 
         <importErrorMessage>Cannot import this Web 
           <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>