Wednesday, July 13, 2011

Setting the ItemStyle for a ContentByQueryWebPart programmatically

If you're using the API to create a Content Query Web Part, if setting the styles, the ItemStyle is a string and can accept the following, which are the xsl:template names in the ItemStyle.xsl file in 14\TEMPLATE\Features\PublishingResources.

Item StyleUI Equivalent
DefaultImage on left
NoImageNo Image
TitleOnlyTitle Only
TitleWithBackgroundTitle With Background
BulletsBulleted title
ImageRightImage on right
ImageTopImage on top
ImageTopCenteredImage on top, centered
LargeTitleLarge title
ClickableImageImage only, clickable
NotClickableImageImage only, not clickable
FixedImageSizeFixed image size
WithDocIconTitle, description and document icon