Friday, July 31, 2009

Setting custom icon for your webparts

Scenario:
I was trying to solve a small mystery for having a custom icon for all my webparts to be able to identify them quickly.

Solution:
I knew Out of Box webpart can do this, so I started looking into existing webpart definition files and found PartImageLarge. PartImageLarge is the property you need to set to change the icon displayed.

custom icon
Code:

<?xml version="1.0" encoding="utf-8"?>
<WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
<Assembly>Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>
<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>
<Title>$Resources:core,ContentEditorWebPartTitle;</Title>
<Description>$Resources:core,ContentEditorWebPartDescription;</Description>
<PartImageLarge>/_layouts/images/customicon16.gif</PartImageLarge>
</WebPart>

Article:

0 comments: