New Work Item Type Controls in TFS 2010

The following post was written by Smitha Saligrama, a software development engineer in test for the work item tracking team in TFS.

With the release of TFS 2010, there are some new work item controls you can take advantage of.

Stand-alone Label

You can now have a stand-alone label control on the work item form without having to attach the label to another control.

These labels can have

  • Plain text
  • Static hyperlinks
  • Dynamic hyperlinks with data coming from work item fields or work item macros

Example 1: Stand-alone label with plain text

<Control Type="LabelControl" Label="Standalone Label Text" ></Control>

Or

<Control Type="LabelControl">
    <LabelText>
         <Text>Standalone label text</Text>
    </LabelText> 
</Control>

Output:

clip_image002[7]

Example 2: Stand-alone label with static hyperlinks

<Control Type="LabelControl">
    <LabelText> 
         <Text>Follow this link <Link UrlRoot="https://www.msn.com/"/> Thank you.</Text>
    </LabelText> 
</Control>

Output:

clip_image004[7]

Example 3: Standalone label with dynamic hyperlinks

Supported macros: @ReportServiceSiteUrl, @ReportManagerUrl, @PortalPage, @ProcessGuidance, @Me  

<Control Type="LabelControl">
    <LabelText> 
        <Text> 
     <Link UrlRoot="@PortalPage" UrlPath="{0}/default.aspx">
              <Param Index="0" Value="System.State" Type="Current"/>
          </Link>LinkLabelExample</Text>
    </LabelText> 
</Control> 

Output:

clip_image006[7]

Url :

clip_image008[12]

You can now have links on the labels that are associated with your controls.

Links can be:

  • Static hyperlinks
  • Dynamic hyperlinks with data coming from work item fields or work item macros

Example 1: Link label with static hyper link

<Control Type="FieldControl" FieldName="Test.Test1" Label="Link Label Example" LabelPosition="Left">
       <Link UrlRoot="https://www.msn.com/"/>
</Control> 

Or

<Control Type="FieldControl" FieldName=" Test.Test1" LabelPosition="Left">
     <LabelText> 
        <Text> 
          <Link UrlRoot="https://www.msn.com/"/>Link Label Example</Text>
     </LabelText> 
</Control>  

Output:

clip_image010[7]

Example 2: Link label with dynamic hyper link

Supported macros: @ReportServiceSiteUrl, @ReportManagerUrl, @PortalPage, @ProcessGuidance, @Me 

<Control Type="FieldControl" FieldName=" Test.Test1" LabelPosition="Left">
     <LabelText> 
         <Text> 
     <Link UrlRoot="@PortalPage" UrlPath="{0}/default.aspx">
               <Param Index="0" Value="System.State" Type="Current"/>
           </Link>Example
</Text>
     </LabelText> 
</Control>

Output:

clip_image012[7]

Url :

clip_image008[13]

Webpage Control

Webpage controls are now supported.

Webpage controls can have

  • CDATA for rendering HTML
  • A web page URL for rendering an actual webpage.

Example 1: CDATA

<Control Type="WebpageControl">
     <WebpageControlOptions> 
           <Content> 
                <![CDATA[Click here for detailed <b><a href="https://www.microsoft.com"> on the company</a></b>]]> 
           </Content> 
     </WebpageControlOptions>
</Control>

Output:

clip_image014[7]

Example 2: Web Page

<Control Type="WebpageControl">
      <WebpageControlOptions ReloadOnParamChange="true">
            <Link UrlRoot="@PortalPage"/>
      </WebpageControlOptions>
</Control>

Output:

clip_image016[7]