Tuesday, November 25, 2008

Adding different icons to an expression box in InfoPath

Firstly, add the icons as resource files:
Tools -> Resource files -> Add
testImage.png

Add the following code to view1.xsl:
<div style="FONT-WEIGHT: normal"> <span class="xdExpressionBox xdDataBindingUI" title="" tabIndex="-1" xd:CtrlId="CTRL799" xd:xctname="ExpressionBox" xd:disableEditing="yes">
<xsl:attribute name="style">FONT-SIZE: x-small; WIDTH: 56px; HEIGHT: 20px;<xsl:choose>
<xsl:when test="@CreatedInState = "1" and @ModifiedFlag = "0" and @DeletedFlag = "0"">DISPLAY: none</xsl:when>
<xsl:when test="@DeletedFlag = "1"">WIDTH: 62px; HEIGHT: 17px; BACKGROUND-IMAGE: url(testImage.png)</xsl:when>
</xsl:choose>
</xsl:attribute>
</span>
</div>

No comments: